From 77d93dbc1c50bb08d7f7fdf97d225fac83cb13e3 Mon Sep 17 00:00:00 2001 From: Andreas Bauer Date: Tue, 25 Jun 2024 22:13:57 +0200 Subject: [PATCH] Remove support for macOS, tvOS and watchOS --- .github/workflows/build-and-test.yml | 46 +------------------ Package.swift | 5 +- .../SpeziDevices/Model/ImageReference.swift | 6 +++ .../Pairing/AccessoryImageView.swift | 4 +- 4 files changed, 10 insertions(+), 51 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e14b6fc..ecb6df4 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -23,14 +23,6 @@ jobs: scheme: SpeziDevices-Package resultBundle: SpeziDevices-iOS.xcresult artifactname: SpeziDevices-iOS.xcresult - packagewatchos: - name: Build and Test Swift Package watchOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - scheme: SpeziDevices-Package - destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' - resultBundle: SpeziDevices-watchOS.xcresult - artifactname: SpeziDevices-watchOS.xcresult packagevisionos: name: Build and Test Swift Package visionOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 @@ -39,22 +31,6 @@ jobs: destination: 'platform=visionOS Simulator,name=Apple Vision Pro' resultBundle: SpeziDevices-visionOS.xcresult artifactname: SpeziDevices-visionOS.xcresult - packagetvos: - name: Build and Test Swift Package tvOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - scheme: SpeziDevices-Package - resultBundle: SpeziDevices-tvOS.xcresult - destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' - artifactname: SpeziDevices-tvOS.xcresult - packagemacos: - name: Build and Test Swift Package macOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - scheme: SpeziDevices-Package - resultBundle: SpeziDevices-macOS.xcresult - destination: 'platform=macOS,arch=arm64' - artifactname: SpeziDevices-macOS.xcresult ios: name: Build and Test iOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 @@ -74,16 +50,6 @@ jobs: destination: 'platform=iOS Simulator,name=iPad Air (5th generation)' resultBundle: TestApp-iPadOS.xcresult artifactname: TestApp-iPadOS.xcresult - watchos: - name: Build and Test watchOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - runsonlabels: '["macOS", "self-hosted"]' - path: 'Tests/UITests' - scheme: TestAppWatchApp - destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' - resultBundle: TestApp-watchOS.xcresult - artifactname: TestApp-watchOS.xcresult visionos: name: Build and Test visionOS uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 @@ -94,16 +60,6 @@ jobs: destination: 'platform=visionOS Simulator,name=Apple Vision Pro' resultBundle: TestApp-visionOS.xcresult artifactname: TestApp-visionOS.xcresult - tvos: - name: Build and Test tvOS - uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - with: - runsonlabels: '["macOS", "self-hosted"]' - path: 'Tests/UITests' - scheme: TestApp - destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' - resultBundle: TestApp-tvOS.xcresult - artifactname: TestApp-tvOS.xcresult codeql: name: CodeQL uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 @@ -119,6 +75,6 @@ jobs: needs: [packageios, packagewatchos, packagevisionos, packagetvos, packagemacos, ios, ipados, watchos, visionos, tvos] uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2 with: - coveragereports: SpeziDevices-iOS.xcresult SpeziDevices-watchOS.xcresult SpeziDevices-visionOS.xcresult SpeziDevices-tvOS.xcresult SpeziDevices-macOS.xcresult TestApp-iOS.xcresult TestApp-iPadOS.xcresult TestApp-watchOS.xcresult TestApp-visionOS.xcresult TestApp-tvOS.xcresult + coveragereports: SpeziDevices-iOS.xcresult SpeziDevices-visionOS.xcresult TestApp-iOS.xcresult TestApp-iPadOS.xcresult TestApp-visionOS.xcresult secrets: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Package.swift b/Package.swift index decde89..9c0f399 100644 --- a/Package.swift +++ b/Package.swift @@ -18,10 +18,7 @@ let package = Package( defaultLocalization: "en", platforms: [ .iOS(.v17), - .watchOS(.v10), - .visionOS(.v1), - .tvOS(.v17), - .macOS(.v14) + .visionOS(.v1) ], products: [ .library(name: "SpeziDevices", targets: ["SpeziDevices"]), diff --git a/Sources/SpeziDevices/Model/ImageReference.swift b/Sources/SpeziDevices/Model/ImageReference.swift index 715f577..dda3bc5 100644 --- a/Sources/SpeziDevices/Model/ImageReference.swift +++ b/Sources/SpeziDevices/Model/ImageReference.swift @@ -27,9 +27,15 @@ extension ImageReference { case let .system(name): return Image(systemName: name) case let .asset(name, bundle: bundle): + #if os(iOS) || os(visionOS) || os(tvOS) guard UIImage(named: name, in: bundle, with: nil) != nil else { return nil } + #elseif os(macOS) + guard NSImage(named: name) != nil else { + return nil + } + #endif return Image(name, bundle: bundle) } } diff --git a/Sources/SpeziDevicesUI/Pairing/AccessoryImageView.swift b/Sources/SpeziDevicesUI/Pairing/AccessoryImageView.swift index 2efdd36..cac7ac7 100644 --- a/Sources/SpeziDevicesUI/Pairing/AccessoryImageView.swift +++ b/Sources/SpeziDevicesUI/Pairing/AccessoryImageView.swift @@ -24,8 +24,8 @@ struct AccessoryImageView: View { .symbolRenderingMode(.hierarchical) // set symbol rendering mode if one uses sf symbols .frame(maxWidth: 250, maxHeight: 120) } - .frame(maxWidth: .infinity, maxHeight: 150) // make drag-able area a bit larger - .background(Color(uiColor: .systemBackground)) // we need to set a non-clear color for it to be drag-able + .frame(maxWidth: .infinity, maxHeight: 150) // make drag-able area a bit larger + .background(Color(uiColor: .systemBackground)) // we need to set a non-clear color for it to be drag-able }