diff --git a/Sources/Runestone/TextView/Appearance/Theme.swift b/Sources/Runestone/TextView/Appearance/Theme.swift index 6482a2938..4ec3db428 100644 --- a/Sources/Runestone/TextView/Appearance/Theme.swift +++ b/Sources/Runestone/TextView/Appearance/Theme.swift @@ -67,6 +67,10 @@ 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 } @@ -74,7 +78,8 @@ public extension Theme { var pageGuideHairlineWidth: CGFloat { 1 / UIScreen.main.scale } - +#endif + var markedTextBackgroundCornerRadius: CGFloat { 0 } diff --git a/Sources/Runestone/TextView/Core/TextView.swift b/Sources/Runestone/TextView/Core/TextView.swift index fd5096c72..b2259e915 100644 --- a/Sources/Runestone/TextView/Core/TextView.swift +++ b/Sources/Runestone/TextView/Core/TextView.swift @@ -197,6 +197,8 @@ open class TextView: UIScrollView { textInputView.selectedTextRange = newValue } } + +#if !os(visionOS) /// The custom input accessory view to display when the receiver becomes the first responder. override public var inputAccessoryView: UIView? { get { @@ -214,6 +216,8 @@ open class TextView: UIScrollView { override public var inputAssistantItem: UITextInputAssistantItem { textInputView.inputAssistantItem } +#endif + /// Returns a Boolean value indicating whether this object can become the first responder. override public var canBecomeFirstResponder: Bool { !textInputView.isFirstResponder && isEditable @@ -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 { diff --git a/Sources/Runestone/TextView/PageGuide/PageGuideView.swift b/Sources/Runestone/TextView/PageGuide/PageGuideView.swift index 2fd6d14d2..b8968ca8c 100644 --- a/Sources/Runestone/TextView/PageGuide/PageGuideView.swift +++ b/Sources/Runestone/TextView/PageGuide/PageGuideView.swift @@ -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 + var hairlineColor: UIColor? { get { hairlineView.backgroundColor