From eafca04e1aef1e9813ee8896f78024f91340bf14 Mon Sep 17 00:00:00 2001 From: Riley Baker Date: Thu, 22 May 2025 21:47:21 -0400 Subject: [PATCH 1/3] Build for Catalyst --- .github/workflows/build-test-and-docs.yml | 45 +++++++++++++++++++ Package.resolved | 4 +- .../UIKitBackend/UIKitBackend+Picker.swift | 2 +- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test-and-docs.yml b/.github/workflows/build-test-and-docs.yml index a9e983a40..f59ba2383 100644 --- a/.github/workflows/build-test-and-docs.yml +++ b/.github/workflows/build-test-and-docs.yml @@ -126,6 +126,51 @@ jobs: xcodebuild: true xcodebuild-device-type: ${{ matrix.device-type }} + uikit-catalyst: + strategy: + matrix: + include: + - os_version: macos-14 + arch: arm64 + - os_version: macos-13 + arch: x86_64 + runs-on: ${{ matrix.os_version }} + steps: + - name: Force Xcode 15.4 + run: sudo xcode-select -switch /Applications/Xcode_15.4.app + + - name: Swift version + run: swift --version + + - name: Install xcbeautify + run: brew install xcbeautify + + - uses: actions/checkout@v3 + + - name: Build + run: | + set -uxo pipefail + buildtarget () { + # Use the same derived data path as DocC compilation so that we don't duplicate work. + xcodebuild -derivedDataPath /tmp/data -skipMacroValidation -scheme "$1" -destination "variant=Mac Catalyst,arch=${{ matrix.arch }},platform=macOS" build | xcbeautify --renderer github-actions + } + + buildtarget SwiftCrossUI + buildtarget UIKitBackend + + cd Examples + + buildtarget CounterExample + buildtarget GreetingGeneratorExample + buildtarget NavigationExample + buildtarget StressTestExample + buildtarget NotesExample + buildtarget PathsExample + buildtarget ControlsExample + buildtarget RandomNumberGeneratorExample + # TODO test whether this works on Catalyst + # buildtarget SplitExample + windows: runs-on: windows-latest defaults: diff --git a/Package.resolved b/Package.resolved index 576739ad3..64f3c56d5 100644 --- a/Package.resolved +++ b/Package.resolved @@ -129,8 +129,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/the-swift-collective/zlib.git", "state" : { - "revision" : "f35d438c14187cb369dfd82603c3427dc66fbed5", - "version" : "1.3.1" + "revision" : "f1d153b90420f9fcc6ef916cd67ea96f0e68d137", + "version" : "1.3.2" } } ], diff --git a/Sources/UIKitBackend/UIKitBackend+Picker.swift b/Sources/UIKitBackend/UIKitBackend+Picker.swift index d2ba674cb..7554a29a9 100644 --- a/Sources/UIKitBackend/UIKitBackend+Picker.swift +++ b/Sources/UIKitBackend/UIKitBackend+Picker.swift @@ -142,7 +142,7 @@ final class UITableViewPicker: WrapperWidget, Picker, UITableViewDe extension UIKitBackend { public func createPicker() -> Widget { #if targetEnvironment(macCatalyst) - if UIDevice.current.userInterfaceIdiom == .mac { + if #available(macCatalyst 14, *), UIDevice.current.userInterfaceIdiom == .mac { return UITableViewPicker() } else { return UIPickerViewPicker() From ccd31a9ce7b8b719d155b72f616e14bcb1240651 Mon Sep 17 00:00:00 2001 From: Riley Baker Date: Thu, 22 May 2025 21:51:59 -0400 Subject: [PATCH 2/3] Always use Mac 14 --- .github/workflows/build-test-and-docs.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test-and-docs.yml b/.github/workflows/build-test-and-docs.yml index f59ba2383..afccfe6b7 100644 --- a/.github/workflows/build-test-and-docs.yml +++ b/.github/workflows/build-test-and-docs.yml @@ -127,14 +127,12 @@ jobs: xcodebuild-device-type: ${{ matrix.device-type }} uikit-catalyst: + runs-on: macos-14 strategy: matrix: - include: - - os_version: macos-14 - arch: arm64 - - os_version: macos-13 - arch: x86_64 - runs-on: ${{ matrix.os_version }} + arch: + - arm64 + - x86_64 steps: - name: Force Xcode 15.4 run: sudo xcode-select -switch /Applications/Xcode_15.4.app From b7d6dbb812d9d33666169cf45e26958c767c29c3 Mon Sep 17 00:00:00 2001 From: William Baker Date: Thu, 22 May 2025 22:53:17 -0400 Subject: [PATCH 3/3] Only build Catalyst on ARM --- .github/workflows/build-test-and-docs.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/build-test-and-docs.yml b/.github/workflows/build-test-and-docs.yml index afccfe6b7..bc0d77b32 100644 --- a/.github/workflows/build-test-and-docs.yml +++ b/.github/workflows/build-test-and-docs.yml @@ -128,11 +128,6 @@ jobs: uikit-catalyst: runs-on: macos-14 - strategy: - matrix: - arch: - - arm64 - - x86_64 steps: - name: Force Xcode 15.4 run: sudo xcode-select -switch /Applications/Xcode_15.4.app @@ -150,7 +145,7 @@ jobs: set -uxo pipefail buildtarget () { # Use the same derived data path as DocC compilation so that we don't duplicate work. - xcodebuild -derivedDataPath /tmp/data -skipMacroValidation -scheme "$1" -destination "variant=Mac Catalyst,arch=${{ matrix.arch }},platform=macOS" build | xcbeautify --renderer github-actions + xcodebuild -derivedDataPath /tmp/data -skipMacroValidation -scheme "$1" -destination "variant=Mac Catalyst,arch=arm64,platform=macOS" build | xcbeautify --renderer github-actions } buildtarget SwiftCrossUI