Skip to content

Commit 642551e

Browse files
sergeirrdavdroman
andauthored
Fix watchOS preview build issue (#380)
Co-authored-by: David Roman <2538074+davdroman@users.noreply.github.com>
1 parent a0cfed3 commit 642551e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+154
-4
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,25 @@ jobs:
8585
os: macos-13
8686
xcode: 15.0.1
8787

88+
- platform: [watchOS, 7]
89+
runtime: watchOS 7.4
90+
os: macos-13
91+
xcode: 14.3.1
92+
install: true
93+
- platform: [watchOS, 8]
94+
runtime: watchOS 8.5
95+
os: macos-13
96+
xcode: 15.0.1
97+
install: true
98+
- platform: [watchOS, 9]
99+
runtime: watchOS 9.4
100+
os: macos-13
101+
xcode: 14.3.1
102+
- platform: [watchOS, 10]
103+
runtime: watchOS 10.0
104+
os: macos-13
105+
xcode: 15.0.1
106+
88107
- platform: [macOS, 12]
89108
runtime: macOS 12
90109
os: macos-12
@@ -127,12 +146,18 @@ jobs:
127146
name: '[Debug] List Available Runtimes, Simulators, and Destinations'
128147
run: |
129148
xcrun simctl list
130-
xcodebuild -scheme "Showcase" -showdestinations
149+
xcodebuild -scheme "SwiftUIIntrospect" -showdestinations
131150
132-
- name: Build Showcase
151+
- if: ${{ matrix.platform[0] != 'watchOS' }}
152+
name: Build Showcase
133153
run: fastlane build platform:${{ matrix.platform[0] }} version:${{ matrix.platform[1] }} scheme:Showcase
134154

135-
- name: Run Tests
155+
- if: ${{ matrix.platform[0] == 'watchOS' }}
156+
name: Build Library
157+
run: fastlane build platform:${{ matrix.platform[0] }} version:${{ matrix.platform[1] }} scheme:SwiftUIIntrospect
158+
159+
- if: ${{ matrix.platform[0] != 'watchOS' }}
160+
name: Run Tests
136161
run: fastlane test platform:${{ matrix.platform[0] }} version:${{ matrix.platform[1] }} scheme:SwiftUIIntrospectTests configuration:Debug
137162

138163
- if: ${{ matrix.platform[0] == 'iOS' && matrix.platform[1] <= '16' }}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Changelog
33

44
## master
55

6+
- Fixed: SwiftUI previews on watchOS no longer fail to build (#380)
7+
- Infrastructure: fixed iOS 17 tests failing on CI (#381)
8+
69
## [1.1.0]
710

811
- Removed: `Toggle` introspection on visionOS (#373)

Sources/Introspect.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !os(watchOS)
12
import SwiftUI
23

34
/// The scope of introspection i.e. where introspect should look to find
@@ -214,3 +215,4 @@ extension NSWindow: PlatformEntity {
214215
public typealias Base = NSWindow
215216
}
216217
#endif
218+
#endif

Sources/IntrospectableViewType.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !os(watchOS)
12
public protocol IntrospectableViewType {
23
/// The scope of introspection for this particular view type, i.e. where introspect
34
/// should look to find the desired target view relative to the applied
@@ -15,3 +16,4 @@ public protocol IntrospectableViewType {
1516
extension IntrospectableViewType {
1617
public var scope: IntrospectionScope { .receiver }
1718
}
19+
#endif

Sources/IntrospectionSelector.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !os(watchOS)
12
@_spi(Advanced)
23
public struct IntrospectionSelector<Target: PlatformEntity> {
34
@_spi(Advanced)
@@ -71,3 +72,4 @@ extension PlatformViewController {
7172
return nil
7273
}
7374
}
75+
#endif

Sources/IntrospectionView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !os(watchOS)
12
import SwiftUI
23

34
typealias IntrospectionViewID = UUID
@@ -242,3 +243,4 @@ extension PlatformEntity {
242243
}
243244
}
244245
}
246+
#endif

Sources/PlatformVersion.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !os(watchOS)
12
import Foundation
23

34
@_spi(Internals)
@@ -309,3 +310,4 @@ extension visionOSVersion {
309310
#endif
310311
}
311312
}
313+
#endif

Sources/PlatformView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !os(watchOS)
12
import SwiftUI
23

34
#if canImport(UIKit)
@@ -53,3 +54,4 @@ extension PlatformViewControllerRepresentable {
5354
}
5455
#endif
5556
}
57+
#endif

Sources/PlatformViewVersion.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !os(watchOS)
12
import SwiftUI
23

34
public struct PlatformViewVersionPredicate<SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity> {
@@ -121,3 +122,4 @@ extension PlatformViewVersion: Comparable {
121122
true
122123
}
123124
}
125+
#endif

Sources/ViewTypes/Button.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !os(watchOS)
12
import SwiftUI
23

34
/// An abstract representation of the `Button` type in SwiftUI.
@@ -43,3 +44,4 @@ extension macOSViewVersion<ButtonType, NSButton> {
4344
}
4445
#endif
4546
#endif
47+
#endif

0 commit comments

Comments
 (0)