Skip to content

Commit

Permalink
Trying to support more platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Jan 22, 2024
1 parent 9828f76 commit 9d743e8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Sources/Neon/NSTextView+VisibleRange.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
#if os(macOS) && !targetEnvironment(macCatalyst)
import AppKit

extension NSTextView {
Expand Down
6 changes: 3 additions & 3 deletions Sources/Neon/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import Foundation

import RangeState

#if canImport(AppKit) && !targetEnvironment(macCatalyst)
#if os(macOS) && !targetEnvironment(macCatalyst)
import AppKit

public typealias TextStorageEditActions = NSTextStorageEditActions
public typealias TextView = NSTextView
#elseif canImport(UIKit)
#elseif os(iOS) || os(iOS) || os(tvOS) || os(visionOS)
import UIKit

public typealias TextStorageEditActions = NSTextStorage.EditActions
public typealias TextView = UITextView
#endif

#if canImport(AppKit) || canImport(UIKit)
#if os(macOS) || os(iOS) || os(iOS) || os(tvOS) || os(visionOS)
extension NSTextStorage: VersionedContent {
public var currentVersion: Int {
hashValue
Expand Down
8 changes: 4 additions & 4 deletions Sources/Neon/TextViewHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import TreeSitterClient
import SwiftTreeSitter
import SwiftTreeSitterLayer

#if canImport(AppKit) && !targetEnvironment(macCatalyst)
#if os(macOS) && !targetEnvironment(macCatalyst)
import AppKit
#elseif canImport(UIKit)
#elseif os(iOS) || os(visionOS)
import UIKit
#endif

Expand All @@ -17,7 +17,7 @@ public enum TextViewHighlighterError: Error {
}

extension TextView {
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
#if os(macOS) && !targetEnvironment(macCatalyst)
func getTextStorage() throws -> NSTextStorage {
guard let storage = textStorage else {
throw TextViewHighlighterError.noTextStorage
Expand Down Expand Up @@ -102,7 +102,7 @@ public final class TextViewHighlighter: NSObject {

try textView.getTextStorage().delegate = self

#if canImport(AppKit) && !targetEnvironment(macCatalyst)
#if os(macOS) && !targetEnvironment(macCatalyst)
guard let scrollView = textView.enclosingScrollView else { return }

NotificationCenter.default.addObserver(self,
Expand Down
4 changes: 2 additions & 2 deletions Sources/Neon/TextViewSystemInterface.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
#if os(macOS) && !targetEnvironment(macCatalyst)
import AppKit
#elseif canImport(UIKit)
#elseif os(iOS) || os(visionOS)
import UIKit
#endif

Expand Down
2 changes: 1 addition & 1 deletion Sources/Neon/UITextView+VisibleRange.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if canImport(UIKit)
#if targetEnvironment(macCatalyst) || os(iOS) || os(visionOS)
import UIKit
import Rearrange

Expand Down

0 comments on commit 9d743e8

Please sign in to comment.