Skip to content

Commit

Permalink
Vision OS compile fixes (#3)
Browse files Browse the repository at this point in the history
* visionOS compile fixes

* VisionOS compile fix
  • Loading branch information
nighthawk authored Dec 2, 2023
1 parent 00bd8b5 commit a9e2ff0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Sources/Runestone/TextView/Appearance/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,19 @@ public protocol Theme: AnyObject {
}

public extension Theme {
#if os(visionOS)
var gutterHairlineWidth: CGFloat { 0.5 }
var pageGuideHairlineWidth: CGFloat { 0.5 }
#else
var gutterHairlineWidth: CGFloat {
1 / UIScreen.main.scale
}

var pageGuideHairlineWidth: CGFloat {
1 / UIScreen.main.scale
}

#endif

Check failure on line 82 in Sources/Runestone/TextView/Appearance/Theme.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
var markedTextBackgroundCornerRadius: CGFloat {
0
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/Runestone/TextView/Core/TextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ open class TextView: UIScrollView {
textInputView.selectedTextRange = newValue
}
}

Check failure on line 200 in Sources/Runestone/TextView/Core/TextView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
#if !os(visionOS)
/// The custom input accessory view to display when the receiver becomes the first responder.
override public var inputAccessoryView: UIView? {
get {
Expand All @@ -214,6 +216,8 @@ open class TextView: UIScrollView {
override public var inputAssistantItem: UITextInputAssistantItem {
textInputView.inputAssistantItem
}
#endif

Check failure on line 220 in Sources/Runestone/TextView/Core/TextView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
/// Returns a Boolean value indicating whether this object can become the first responder.
override public var canBecomeFirstResponder: Bool {
!textInputView.isFirstResponder && isEditable
Expand Down Expand Up @@ -606,7 +610,9 @@ open class TextView: UIScrollView {
#endif
private let tapGestureRecognizer = QuickTapGestureRecognizer()
private var _inputAccessoryView: UIView?
#if !os(visionOS)
private let _inputAssistantItem = UITextInputAssistantItem()
#endif
private var isPerformingNonEditableTextInteraction = false
private var delegateAllowsEditingToBegin: Bool {
guard isEditable else {
Expand Down
7 changes: 6 additions & 1 deletion Sources/Runestone/TextView/PageGuide/PageGuideView.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import UIKit

final class PageGuideView: UIView {
var hairlineWidth: CGFloat = 1 / UIScreen.main.scale {
#if os(visionOS)
var hairlineWidth: CGFloat = 0.5
#else
var hairlineWidth: CGFloat = 1 / UIScreen.main.scale {
didSet {
if hairlineWidth != oldValue {
setNeedsLayout()
}
}
}
#endif

Check failure on line 15 in Sources/Runestone/TextView/PageGuide/PageGuideView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
var hairlineColor: UIColor? {
get {
hairlineView.backgroundColor
Expand Down

0 comments on commit a9e2ff0

Please sign in to comment.