Skip to content

Commit eafca04

Browse files
committed
Build for Catalyst
1 parent fba2e45 commit eafca04

File tree

3 files changed

+48
-3
lines changed

3 files changed

+48
-3
lines changed

.github/workflows/build-test-and-docs.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,51 @@ jobs:
126126
xcodebuild: true
127127
xcodebuild-device-type: ${{ matrix.device-type }}
128128

129+
uikit-catalyst:
130+
strategy:
131+
matrix:
132+
include:
133+
- os_version: macos-14
134+
arch: arm64
135+
- os_version: macos-13
136+
arch: x86_64
137+
runs-on: ${{ matrix.os_version }}
138+
steps:
139+
- name: Force Xcode 15.4
140+
run: sudo xcode-select -switch /Applications/Xcode_15.4.app
141+
142+
- name: Swift version
143+
run: swift --version
144+
145+
- name: Install xcbeautify
146+
run: brew install xcbeautify
147+
148+
- uses: actions/checkout@v3
149+
150+
- name: Build
151+
run: |
152+
set -uxo pipefail
153+
buildtarget () {
154+
# Use the same derived data path as DocC compilation so that we don't duplicate work.
155+
xcodebuild -derivedDataPath /tmp/data -skipMacroValidation -scheme "$1" -destination "variant=Mac Catalyst,arch=${{ matrix.arch }},platform=macOS" build | xcbeautify --renderer github-actions
156+
}
157+
158+
buildtarget SwiftCrossUI
159+
buildtarget UIKitBackend
160+
161+
cd Examples
162+
163+
buildtarget CounterExample
164+
buildtarget GreetingGeneratorExample
165+
buildtarget NavigationExample
166+
buildtarget StressTestExample
167+
buildtarget NotesExample
168+
buildtarget PathsExample
169+
buildtarget ControlsExample
170+
buildtarget RandomNumberGeneratorExample
171+
# TODO test whether this works on Catalyst
172+
# buildtarget SplitExample
173+
129174
windows:
130175
runs-on: windows-latest
131176
defaults:

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/UIKitBackend/UIKitBackend+Picker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ final class UITableViewPicker: WrapperWidget<UITableView>, Picker, UITableViewDe
142142
extension UIKitBackend {
143143
public func createPicker() -> Widget {
144144
#if targetEnvironment(macCatalyst)
145-
if UIDevice.current.userInterfaceIdiom == .mac {
145+
if #available(macCatalyst 14, *), UIDevice.current.userInterfaceIdiom == .mac {
146146
return UITableViewPicker()
147147
} else {
148148
return UIPickerViewPicker()

0 commit comments

Comments
 (0)