diff --git a/Sources/Neon/NSTextView+VisibleRange.swift b/Sources/Neon/NSTextView+VisibleRange.swift index 0d38d58..c515d0c 100644 --- a/Sources/Neon/NSTextView+VisibleRange.swift +++ b/Sources/Neon/NSTextView+VisibleRange.swift @@ -1,4 +1,4 @@ -#if canImport(AppKit) && !targetEnvironment(macCatalyst) +#if os(macOS) && !targetEnvironment(macCatalyst) import AppKit extension NSTextView { diff --git a/Sources/Neon/Platform.swift b/Sources/Neon/Platform.swift index 304fee6..388960e 100644 --- a/Sources/Neon/Platform.swift +++ b/Sources/Neon/Platform.swift @@ -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 diff --git a/Sources/Neon/TextViewHighlighter.swift b/Sources/Neon/TextViewHighlighter.swift index 11d8881..8173ee6 100644 --- a/Sources/Neon/TextViewHighlighter.swift +++ b/Sources/Neon/TextViewHighlighter.swift @@ -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 @@ -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 @@ -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, diff --git a/Sources/Neon/TextViewSystemInterface.swift b/Sources/Neon/TextViewSystemInterface.swift index 20199af..a095be4 100644 --- a/Sources/Neon/TextViewSystemInterface.swift +++ b/Sources/Neon/TextViewSystemInterface.swift @@ -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 diff --git a/Sources/Neon/UITextView+VisibleRange.swift b/Sources/Neon/UITextView+VisibleRange.swift index 3eb92c4..9c381de 100644 --- a/Sources/Neon/UITextView+VisibleRange.swift +++ b/Sources/Neon/UITextView+VisibleRange.swift @@ -1,4 +1,4 @@ -#if canImport(UIKit) +#if targetEnvironment(macCatalyst) || os(iOS) || os(visionOS) import UIKit import Rearrange