From 5500fa8811ed339605b0861ae0390677863a7bfe Mon Sep 17 00:00:00 2001 From: Marcin Krzyzanowski Date: Mon, 23 Oct 2023 23:40:12 +0200 Subject: [PATCH] Add UIKit support --- Package.swift | 2 +- Sources/STTextKitPlus/NSRange.swift | 5 ++++- Sources/STTextKitPlus/NSTextContentManager.swift | 5 ++++- Sources/STTextKitPlus/NSTextLayoutFragment.swift | 5 ++++- Sources/STTextKitPlus/NSTextLayoutManager.swift | 5 ++++- .../STTextKitPlus/NSTextLineFragment+ExtraLineFragment.swift | 5 ++++- Sources/STTextKitPlus/NSTextLineFragment.swift | 4 ++++ Sources/STTextKitPlus/NSTextLocation+Equatable.swift | 5 ++++- Sources/STTextKitPlus/NSTextRange.swift | 5 ++++- 9 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Package.swift b/Package.swift index bcd1b0d..3a17245 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,7 @@ import PackageDescription let package = Package( name: "STTextKitPlus", - platforms: [.macOS(.v12)], + platforms: [.macOS(.v12), .iOS(.v15)], products: [ .library( name: "STTextKitPlus", diff --git a/Sources/STTextKitPlus/NSRange.swift b/Sources/STTextKitPlus/NSRange.swift index ab6c189..971bc94 100644 --- a/Sources/STTextKitPlus/NSRange.swift +++ b/Sources/STTextKitPlus/NSRange.swift @@ -1,7 +1,10 @@ // Created by Marcin Krzyzanowski -// https://github.com/krzyzanowskim/STTextView/blob/main/LICENSE.md +#if canImport(AppKit) import AppKit +#elseif canImport(UIKit) +import UIKit +#endif extension NSRange { diff --git a/Sources/STTextKitPlus/NSTextContentManager.swift b/Sources/STTextKitPlus/NSTextContentManager.swift index e53894c..375c340 100644 --- a/Sources/STTextKitPlus/NSTextContentManager.swift +++ b/Sources/STTextKitPlus/NSTextContentManager.swift @@ -1,7 +1,10 @@ // Created by Marcin Krzyzanowski -// https://github.com/krzyzanowskim/STTextView/blob/main/LICENSE.md +#if canImport(AppKit) import AppKit +#elseif canImport(UIKit) +import UIKit +#endif public extension NSTextContentManager { diff --git a/Sources/STTextKitPlus/NSTextLayoutFragment.swift b/Sources/STTextKitPlus/NSTextLayoutFragment.swift index bec2baf..f44fc9f 100644 --- a/Sources/STTextKitPlus/NSTextLayoutFragment.swift +++ b/Sources/STTextKitPlus/NSTextLayoutFragment.swift @@ -1,7 +1,10 @@ // Created by Marcin Krzyzanowski -// https://github.com/krzyzanowskim/STTextView/blob/main/LICENSE.md +#if canImport(AppKit) import AppKit +#elseif canImport(UIKit) +import UIKit +#endif extension NSTextLayoutFragment { diff --git a/Sources/STTextKitPlus/NSTextLayoutManager.swift b/Sources/STTextKitPlus/NSTextLayoutManager.swift index 73581e6..be7ca5b 100644 --- a/Sources/STTextKitPlus/NSTextLayoutManager.swift +++ b/Sources/STTextKitPlus/NSTextLayoutManager.swift @@ -1,7 +1,10 @@ // Created by Marcin Krzyzanowski -// https://github.com/krzyzanowskim/STTextView/blob/main/LICENSE.md +#if canImport(AppKit) import AppKit +#elseif canImport(UIKit) +import UIKit +#endif extension NSTextLayoutManager { diff --git a/Sources/STTextKitPlus/NSTextLineFragment+ExtraLineFragment.swift b/Sources/STTextKitPlus/NSTextLineFragment+ExtraLineFragment.swift index 1b74ced..69d3b7a 100644 --- a/Sources/STTextKitPlus/NSTextLineFragment+ExtraLineFragment.swift +++ b/Sources/STTextKitPlus/NSTextLineFragment+ExtraLineFragment.swift @@ -1,7 +1,10 @@ // Created by Marcin Krzyzanowski -// https://github.com/krzyzanowskim/STTextView/blob/main/LICENSE.md +#if canImport(AppKit) import AppKit +#elseif canImport(UIKit) +import UIKit +#endif extension NSTextLineFragment { diff --git a/Sources/STTextKitPlus/NSTextLineFragment.swift b/Sources/STTextKitPlus/NSTextLineFragment.swift index 4b3cf07..733c717 100644 --- a/Sources/STTextKitPlus/NSTextLineFragment.swift +++ b/Sources/STTextKitPlus/NSTextLineFragment.swift @@ -1,4 +1,8 @@ +#if canImport(AppKit) import AppKit +#elseif canImport(UIKit) +import UIKit +#endif extension NSTextLineFragment { diff --git a/Sources/STTextKitPlus/NSTextLocation+Equatable.swift b/Sources/STTextKitPlus/NSTextLocation+Equatable.swift index 94cca3a..f4e3abd 100644 --- a/Sources/STTextKitPlus/NSTextLocation+Equatable.swift +++ b/Sources/STTextKitPlus/NSTextLocation+Equatable.swift @@ -1,7 +1,10 @@ // Created by Marcin Krzyzanowski -// https://github.com/krzyzanowskim/STTextView/blob/main/LICENSE.md +#if canImport(AppKit) import AppKit +#elseif canImport(UIKit) +import UIKit +#endif public extension NSTextLocation { diff --git a/Sources/STTextKitPlus/NSTextRange.swift b/Sources/STTextKitPlus/NSTextRange.swift index 7a812d9..f8c5200 100644 --- a/Sources/STTextKitPlus/NSTextRange.swift +++ b/Sources/STTextKitPlus/NSTextRange.swift @@ -1,7 +1,10 @@ // Created by Marcin Krzyzanowski -// https://github.com/krzyzanowskim/STTextView/blob/main/LICENSE.md +#if canImport(AppKit) import AppKit +#elseif canImport(UIKit) +import UIKit +#endif extension NSTextRange {