Skip to content

Commit c36fd4d

Browse files
authored
CI: fix macCatalyst Showcase and tests (#496)
1 parent 924d3cc commit c36fd4d

31 files changed

+453
-611
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,24 @@ jobs:
6161
- [iPadOS, 18, 6]
6262
- [iPadOS, 26, 0]
6363

64+
- [macCatalyst, 15, 0]
65+
- [macOS, 15, 0]
66+
6467
- [tvOS, 15, 4]
6568
- [tvOS, 16, 4]
6669
- [tvOS, 17, 5]
6770
- [tvOS, 18, 5]
6871
- [tvOS, 26, 0]
6972

73+
- [visionOS, 1, 2]
74+
- [visionOS, 2, 5]
75+
- [visionOS, 26, 0]
76+
7077
- [watchOS, 8, 5]
7178
- [watchOS, 9, 4]
7279
- [watchOS, 10, 5]
7380
- [watchOS, 11, 5]
7481
- [watchOS, 26, 0]
75-
76-
- [macOS, 15, 0]
77-
# - [macOS, 26, 0]
78-
79-
- [visionOS, 1, 2]
80-
- [visionOS, 2, 5]
81-
- [visionOS, 26, 0]
8282
steps:
8383
- name: Git Checkout
8484
uses: actions/checkout@v5
@@ -97,13 +97,20 @@ jobs:
9797
else
9898
case "$PLATFORM" in
9999
iOS) SCRIPT_PLATFORM=ios ;;
100+
macOS) SCRIPT_PLATFORM=macos ;;
101+
macCatalyst) SCRIPT_PLATFORM=mac-catalyst ;;
100102
tvOS) SCRIPT_PLATFORM=tvos ;;
101-
watchOS) SCRIPT_PLATFORM=watchos ;;
102103
visionOS) SCRIPT_PLATFORM=visionos ;;
103-
macOS) SCRIPT_PLATFORM=macos ;;
104+
watchOS) SCRIPT_PLATFORM=watchos ;;
104105
esac
105106
fi
106107
108+
if [ "$PLATFORM" = "macCatalyst" ]; then
109+
XCB_PLATFORM="mac-catalyst"
110+
else
111+
XCB_PLATFORM="$PLATFORM"
112+
fi
113+
107114
RUNTIME="$PLATFORM $MAJOR.$MINOR"
108115
109116
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
@@ -112,7 +119,7 @@ jobs:
112119
echo "RUNTIME=$RUNTIME" >> $GITHUB_ENV
113120
echo "SCRIPT_PLATFORM=$SCRIPT_PLATFORM" >> $GITHUB_ENV
114121
115-
- if: ${{ env.PLATFORM != 'macOS' }}
122+
- if: ${{ env.PLATFORM != 'macCatalyst' && env.PLATFORM != 'macOS' }}
116123
name: Check for ${{ env.RUNTIME }} runtime
117124
run: |
118125
if xcrun simctl list runtimes | grep -q "$RUNTIME"; then
@@ -140,7 +147,7 @@ jobs:
140147
max_attempts: 3
141148
command: sudo xcodes runtimes install "$RUNTIME"
142149

143-
- if: ${{ env.PLATFORM != 'macOS' }}
150+
- if: ${{ env.PLATFORM != 'macCatalyst' && env.PLATFORM != 'macOS' }}
144151
name: Create Required Simulators
145152
run: |
146153
set -eo pipefail
@@ -162,7 +169,7 @@ jobs:
162169
uses: davdroman/xcodebuild@destination
163170
with:
164171
xcode: ~26.0
165-
platform: ${{ env.PLATFORM }}
172+
platform: ${{ env.XCB_PLATFORM }}
166173
platform-version: ~${{ env.MAJOR }}.${{ env.MINOR }}
167174
destination: ${{ env.SIM_UDID }}
168175
action: build
@@ -175,7 +182,7 @@ jobs:
175182
uses: davdroman/xcodebuild@destination
176183
with:
177184
xcode: ~26.0
178-
platform: ${{ env.PLATFORM }}
185+
platform: ${{ env.XCB_PLATFORM }}
179186
platform-version: ~${{ env.MAJOR }}.${{ env.MINOR }}
180187
destination: ${{ env.SIM_UDID }}
181188
action: build
@@ -188,7 +195,7 @@ jobs:
188195
uses: davdroman/xcodebuild@destination
189196
with:
190197
xcode: ~26.0
191-
platform: ${{ env.PLATFORM }}
198+
platform: ${{ env.XCB_PLATFORM }}
192199
platform-version: ~${{ env.MAJOR }}.${{ env.MINOR }}
193200
destination: ${{ env.SIM_UDID }}
194201
action: test
@@ -203,20 +210,20 @@ jobs:
203210
strategy:
204211
fail-fast: false
205212
matrix:
206-
platform: [iOS, macOS, tvOS, watchOS, visionOS, macCatalyst]
213+
platform: [iOS, macCatalyst, macOS, tvOS, visionOS, watchOS]
207214
include:
208215
- platform: iOS
209216
destination: "generic/platform=iOS"
217+
- platform: macCatalyst
218+
destination: "platform=macOS,variant=Mac Catalyst"
210219
- platform: macOS
211220
destination: "generic/platform=macOS"
212221
- platform: tvOS
213222
destination: "generic/platform=tvOS"
214-
- platform: watchOS
215-
destination: "generic/platform=watchOS"
216223
- platform: visionOS
217224
destination: "generic/platform=visionOS"
218-
- platform: macCatalyst
219-
destination: "platform=macOS,variant=Mac Catalyst"
225+
- platform: watchOS
226+
destination: "generic/platform=watchOS"
220227
steps:
221228
- name: Git Checkout
222229
uses: actions/checkout@v5

Examples/Showcase/Showcase/Controls.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ struct ControlsShowcase: View {
7474
#endif
7575
}
7676

77+
#if !targetEnvironment(macCatalyst)
7778
HStack {
7879
Slider(value: $sliderValue, in: 0...100)
7980
#if os(iOS)
@@ -97,6 +98,7 @@ struct ControlsShowcase: View {
9798
}
9899
#endif
99100
}
101+
#endif
100102

101103
HStack {
102104
Stepper(onIncrement: {}, onDecrement: {}) {

SwiftUIIntrospect.xcworkspace/xcshareddata/xcschemes/SwiftUIIntrospect.xcscheme

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
33
LastUpgradeVersion = "2600"
4-
version = "1.3">
4+
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"
7-
buildImplicitDependencies = "YES">
7+
buildImplicitDependencies = "YES"
8+
buildArchitectures = "Automatic">
89
<BuildActionEntries>
910
<BuildActionEntry
1011
buildForTesting = "YES"
@@ -26,9 +27,8 @@
2627
buildConfiguration = "Debug"
2728
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2829
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
shouldUseLaunchSchemeArgsEnv = "YES">
30-
<Testables>
31-
</Testables>
30+
shouldUseLaunchSchemeArgsEnv = "YES"
31+
shouldAutocreateTestPlan = "YES">
3232
</TestAction>
3333
<LaunchAction
3434
buildConfiguration = "Debug"

Tests/Package.swift

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
//
2-
// TestFramework.swift
3-
// TestFramework
4-
//
5-
// Created by David Roman on 30/07/2025.
6-
//
7-
8-
import Foundation
1+
internal import SwiftUI
2+
internal import SwiftUIIntrospect
93

4+
struct TestView: View {
5+
var body: some View {
6+
Text("Hello, World!")
7+
#if os(iOS) || os(tvOS) || os(visionOS)
8+
.introspect(.view, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), customize: { _ in })
9+
#elseif os(macOS)
10+
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: { _ in })
11+
#endif
12+
}
13+
}

0 commit comments

Comments
 (0)