Skip to content

Commit

Permalink
Guard tvOS references
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Nov 25, 2024
1 parent cd0b80f commit 68a6bcd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Projects/NeonExample/TextViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class TextViewController: NSUIViewController {
super.init(nibName: nil, bundle: nil)

// enable non-continguous layout for TextKit 1
if #available(macOS 12.0, iOS 16.0, *), textView.textLayoutManager == nil {
if #available(macOS 12.0, iOS 16.0, tvOS 15.0, *), textView.textLayoutManager == nil {
textView.nsuiLayoutManager?.allowsNonContiguousLayout = true
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Neon/PlatformTextSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension NSTextContentManager: VersionedContent {

extension NSTextContainer {
func textRange(for rect: CGRect) -> NSRange? {
if #available(macOS 12.0, iOS 15.0, *), textLayoutManager != nil {
if #available(macOS 12.0, iOS 15.0, tvOS 15.0, *), textLayoutManager != nil {
return nil
}

Expand All @@ -59,7 +59,7 @@ extension NSTextContainer {
extension TextView {
var tk2VisibleTextRange: NSRange? {
guard
#available(macOS 12.0, iOS 16.0, *),
#available(macOS 12.0, iOS 16.0, tvOS 15.0, *),
let textLayoutManager,

Check failure on line 63 in Sources/Neon/PlatformTextSystem.swift

View workflow job for this annotation

GitHub Actions / Test (platform=tvOS Simulator,name=Apple TV)

'textLayoutManager' is only available in tvOS 16.0 or newer
let viewportRange = textLayoutManager.textViewportLayoutController.viewportRange,
let textContentManager = textLayoutManager.textContentManager
Expand Down

0 comments on commit 68a6bcd

Please sign in to comment.