Skip to content

Commit f941f6b

Browse files
authored
Merge pull request #120 from ropellanda/main
Add visionOS support
2 parents 63bf134 + fe7dc63 commit f941f6b

34 files changed

+54
-54
lines changed

Sources/RichTextKit/Actions/RichTextActionButtonGroup.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright © 2022-2023 Daniel Saidi. All rights reserved.
77
//
88

9-
#if iOS || macOS
9+
#if iOS || macOS || os(visionOS)
1010
import SwiftUI
1111

1212
/**

Sources/RichTextKit/Actions/View+RichTextAction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public extension View {
1515
*/
1616
@ViewBuilder
1717
func keyboardShortcut(for action: RichTextAction) -> some View {
18-
#if iOS || macOS
18+
#if iOS || macOS || os(visionOS)
1919
switch action {
2020
case .copy: keyboardShortcut("c", modifiers: .command)
2121
case .dismissKeyboard: self

Sources/RichTextKit/Alignment/View+RichTextAlignment.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public extension View {
1818
*/
1919
@ViewBuilder
2020
func keyboardShortcut(for alignment: RichTextAlignment) -> some View {
21-
#if iOS || macOS
21+
#if iOS || macOS || os(visionOS)
2222
switch alignment {
2323
case .left: keyboardShortcut("Ö", modifiers: [.command, .shift])
2424
case .center: keyboardShortcut("*", modifiers: [.command])

Sources/RichTextKit/Bundle/Bundle+RichTextKit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extension Bundle {
6969
}
7070

7171
func bundlePath(for locale: Locale) -> String? {
72-
bundlePath(named: locale.identifier) ?? bundlePath(named: locale.languageCode)
72+
bundlePath(named: locale.identifier) ?? bundlePath(named: locale.language.languageCode?.identifier)
7373
}
7474

7575
func bundlePath(named name: String?) -> String? {

Sources/RichTextKit/Colors/ColorRepresentable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public typealias ColorRepresentable = NSColor
1717
#endif
1818

1919

20-
#if iOS || os(tvOS) || os(watchOS)
20+
#if iOS || os(tvOS) || os(watchOS) || os(visionOS)
2121
import UIKit
2222

2323
/**

Sources/RichTextKit/Colors/RichTextColorPicker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private extension RichTextColorPicker {
104104

105105
@ViewBuilder
106106
var picker: some View {
107-
#if iOS || macOS
107+
#if iOS || macOS || os(visionOS)
108108
ColorPicker("", selection: $value)
109109
.fixedSize()
110110
.padding(.horizontal, spacing)

Sources/RichTextKit/Commands/RichTextFormatCommandMenu.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright © 2022-2023 Daniel Saidi. All rights reserved.
77
//
88

9-
#if iOS || macOS
9+
#if iOS || macOS || os(visionOS)
1010
import SwiftUI
1111

1212
/**

Sources/RichTextKit/Commands/RichTextShareCommandMenu.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright © 2022-2023 Daniel Saidi. All rights reserved.
77
//
88

9-
#if iOS || macOS
9+
#if iOS || macOS || os(visionOS)
1010
import SwiftUI
1111

1212
/**

Sources/RichTextKit/Component/RichTextViewComponent+Pasting.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public extension RichTextViewComponent {
5959
at index: Int,
6060
moveCursorToPastedContent move: Bool = false
6161
) {
62-
#if iOS || os(tvOS) || os(macOS)
62+
#if iOS || os(tvOS) || os(macOS) || os(visionOS)
6363
guard validateImageInsertion(for: imagePasteConfiguration) else { return }
6464
let items = images.count * 2 // The number of inserted "items" is the images and a newline for each
6565
let insertRange = NSRange(location: index, length: 0)
@@ -113,7 +113,7 @@ public extension RichTextViewComponent {
113113
}
114114
}
115115

116-
#if iOS || os(tvOS) || os(macOS)
116+
#if iOS || os(tvOS) || os(macOS) || os(visionOS)
117117
private extension RichTextViewComponent {
118118

119119
func getAttachmentString(

Sources/RichTextKit/Coordinator/RichTextCoordinator+Subscriptions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright © 2022-2023 Daniel Saidi. All rights reserved.
77
//
88

9-
#if iOS || macOS || os(tvOS)
9+
#if iOS || macOS || os(tvOS) || os(visionOS)
1010
import SwiftUI
1111

1212
extension RichTextCoordinator {
@@ -334,13 +334,13 @@ internal extension RichTextCoordinator {
334334
func setIsEditing(to newValue: Bool) {
335335
if newValue == textView.isFirstResponder { return }
336336
if newValue {
337-
#if iOS
337+
#if iOS || os(visionOS)
338338
textView.becomeFirstResponder()
339339
#else
340340
print("macOS currently doesn't resign first responder.")
341341
#endif
342342
} else {
343-
#if iOS
343+
#if iOS || os(visionOS)
344344
textView.resignFirstResponder()
345345
#else
346346
print("macOS currently doesn't resign first responder.")
@@ -362,7 +362,7 @@ internal extension RichTextCoordinator {
362362

363363
private extension ColorRepresentable {
364364

365-
#if iOS || os(tvOS)
365+
#if iOS || os(tvOS) || os(visionOS)
366366
static var textColor: ColorRepresentable { .label }
367367
#endif
368368
}

0 commit comments

Comments
 (0)