Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 688fa07

Browse files
authoredNov 30, 2023
Enable backwards compatibility when compiling with Xcode 14 (#329)
* Enable backwards compatibility when compiling with Xcode 14 This will still mean that the bug addressed in #314 will persist, but will allow consumers bound to older Xcode versions to continue to update the rest of the codebase and its dependencies * Add end-of-file new lines * Safe-guard usage as well
1 parent 64aecb2 commit 688fa07

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed
 

‎Sources/Runestone/Library/UITextInput+Helpers.swift

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import UIKit
22

3+
#if compiler(>=5.9)
4+
35
@available(iOS 17, *)
46
extension UITextInput where Self: NSObject {
57
var sbs_textSelectionDisplayInteraction: UITextSelectionDisplayInteraction? {
@@ -17,3 +19,5 @@ extension UITextInput where Self: NSObject {
1719
return interactionAssistant.value(forKey: selectionViewManagerKey) as? UITextSelectionDisplayInteraction
1820
}
1921
}
22+
23+
#endif
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import UIKit
22

3+
#if compiler(>=5.9)
4+
35
@available(iOS 17, *)
46
extension UITextSelectionDisplayInteraction {
57
func sbs_enableCursorBlinks() {
68
setValue(true, forKey: "rosruc".reversed() + "Blinks")
79
}
810
}
11+
12+
#endif

‎Sources/Runestone/TextView/Core/TextView.swift

+4
Original file line numberDiff line numberDiff line change
@@ -1234,10 +1234,12 @@ private extension TextView {
12341234
isInputAccessoryViewEnabled = true
12351235
textInputView.removeInteraction(nonEditableTextInteraction)
12361236
textInputView.addInteraction(editableTextInteraction)
1237+
#if compiler(>=5.9)
12371238
if #available(iOS 17, *) {
12381239
// Workaround a bug where the caret does not appear until the user taps again on iOS 17 (FB12622609).
12391240
textInputView.sbs_textSelectionDisplayInteraction?.isActivated = true
12401241
}
1242+
#endif
12411243
}
12421244
}
12431245

@@ -1390,10 +1392,12 @@ extension TextView: TextInputViewDelegate {
13901392
if !view.viewHierarchyContainsCaret && self.editableTextInteraction.view != nil {
13911393
view.removeInteraction(self.editableTextInteraction)
13921394
view.addInteraction(self.editableTextInteraction)
1395+
#if compiler(>=5.9)
13931396
if #available(iOS 17, *) {
13941397
self.textInputView.sbs_textSelectionDisplayInteraction?.isActivated = true
13951398
self.textInputView.sbs_textSelectionDisplayInteraction?.sbs_enableCursorBlinks()
13961399
}
1400+
#endif
13971401
}
13981402
}
13991403
}

0 commit comments

Comments
 (0)
Please sign in to comment.