diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0921695..aa54d40 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,13 +15,13 @@ env: jobs: build: - runs-on: macos-13 + runs-on: macos-15 steps: - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '15.1.0' - - name: Build iOS - run: xcodebuild -scheme $SCHEME -derivedDataPath .build -destination 'generic/platform=iOS'; + xcode-version: '16.0' + - name: Build all platforms + run: bash scripts/build.sh ${{ github.event.repository.name }} - name: Test iOS - run: xcodebuild test -scheme $TEST_SCHEME -derivedDataPath .build -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' -enableCodeCoverage YES; + run: bash scripts/test.sh ${{ github.event.repository.name }} diff --git a/Package.swift b/Package.swift index f5913c0..8e8e848 100644 --- a/Package.swift +++ b/Package.swift @@ -7,7 +7,7 @@ let package = Package( platforms: [ .iOS(.v15), .macOS(.v12), - .tvOS(.v15), + .tvOS(.v17), .watchOS(.v8), .visionOS(.v1) ], diff --git a/RichEditorDemo/RichEditorDemo.xcodeproj/project.pbxproj b/RichEditorDemo/RichEditorDemo.xcodeproj/project.pbxproj index 584d5cf..875ff8c 100644 --- a/RichEditorDemo/RichEditorDemo.xcodeproj/project.pbxproj +++ b/RichEditorDemo/RichEditorDemo.xcodeproj/project.pbxproj @@ -305,7 +305,7 @@ "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 14.0; @@ -319,6 +319,7 @@ SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3"; + TVOS_DEPLOYMENT_TARGET = 17.0; }; name = Debug; }; @@ -343,7 +344,7 @@ "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 14.0; @@ -357,6 +358,7 @@ SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3"; + TVOS_DEPLOYMENT_TARGET = 17.0; }; name = Release; }; diff --git a/RichEditorDemo/RichEditorDemo/ContentView.swift b/RichEditorDemo/RichEditorDemo/ContentView.swift index f4e1322..2c78d10 100644 --- a/RichEditorDemo/RichEditorDemo/ContentView.swift +++ b/RichEditorDemo/RichEditorDemo/ContentView.swift @@ -52,7 +52,7 @@ struct ContentView: View { } .background(colorScheme == .dark ? .black : .gray.opacity(0.07)) .navigationTitle("Rich Editor") - #if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) + #if os(iOS) .navigationBarTitleDisplayMode(.inline) #endif } diff --git a/Sources/RichEditorSwiftUI/UI/Editor/RichEditor.swift b/Sources/RichEditorSwiftUI/UI/Editor/RichEditor.swift index a5ce0fb..5c4a781 100644 --- a/Sources/RichEditorSwiftUI/UI/Editor/RichEditor.swift +++ b/Sources/RichEditorSwiftUI/UI/Editor/RichEditor.swift @@ -124,9 +124,9 @@ public struct RichTextEditor: ViewRepresentable { public func makeNSView(context: Context) -> some NSView { if self.context.internalSpans.isEmpty { - textView.setup(with: self.context.attributedString) + textView.setup() } else { - textView.setup(with: self.context.internalSpans) + textView.setup() } textView.configuration = config textView.theme = style diff --git a/Sources/RichEditorSwiftUI/UI/EditorToolBar/EditorToolBarView.swift b/Sources/RichEditorSwiftUI/UI/EditorToolBar/EditorToolBarView.swift index c12b3b7..6cccd93 100644 --- a/Sources/RichEditorSwiftUI/UI/EditorToolBar/EditorToolBarView.swift +++ b/Sources/RichEditorSwiftUI/UI/EditorToolBar/EditorToolBarView.swift @@ -124,11 +124,13 @@ struct TitleStyleButton: View { .cornerRadius(5) .padding(.vertical, 5) }) +#if !os(tvOS) .onTapGesture { isExpanded.toggle() } - +#endif } + func hasStyle(_ style: TextSpanStyle) -> Bool { return appliedTools.contains(where: { $0.key == style.key }) diff --git a/Sources/RichEditorSwiftUI/UI/TextViewUI/RichTextView_AppKit.swift b/Sources/RichEditorSwiftUI/UI/TextViewUI/RichTextView_AppKit.swift index 0e68e6d..8404bcf 100644 --- a/Sources/RichEditorSwiftUI/UI/TextViewUI/RichTextView_AppKit.swift +++ b/Sources/RichEditorSwiftUI/UI/TextViewUI/RichTextView_AppKit.swift @@ -24,6 +24,7 @@ import AppKit */ open class RichTextView: NSTextView, RichTextViewComponent { + // MARK: - Properties /// The configuration to use by the rich text view. @@ -106,8 +107,8 @@ open class RichTextView: NSTextView, RichTextViewComponent { - text: The text to edit with the text view. - format: The rich text format to edit. */ - open func setup(with text: NSAttributedString? = nil) { - setupSharedBehavior(with: text) + open func setup() { + setupSharedBehavior() allowsImageEditing = true allowsUndo = true layoutManager?.defaultAttachmentScaling = NSImageScaling.scaleProportionallyDown