Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix watchOS preview build issue #380

Merged
merged 18 commits into from
Oct 27, 2023
31 changes: 28 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,25 @@ jobs:
os: macos-13
xcode: 15.0.1

- platform: [watchOS, 7]
runtime: watchOS 7.4
os: macos-13
xcode: 14.3.1
install: true
- platform: [watchOS, 8]
runtime: watchOS 8.5
os: macos-13
xcode: 15.0.1
install: true
- platform: [watchOS, 9]
runtime: watchOS 9.4
os: macos-13
xcode: 14.3.1
- platform: [watchOS, 10]
runtime: watchOS 10.0
os: macos-13
xcode: 15.0.1

- platform: [macOS, 12]
runtime: macOS 12
os: macos-12
Expand Down Expand Up @@ -127,12 +146,18 @@ jobs:
name: '[Debug] List Available Runtimes, Simulators, and Destinations'
run: |
xcrun simctl list
xcodebuild -scheme "Showcase" -showdestinations
xcodebuild -scheme "SwiftUIIntrospect" -showdestinations

- name: Build Showcase
- if: ${{ matrix.platform[0] != 'watchOS' }}
name: Build Showcase
run: fastlane build platform:${{ matrix.platform[0] }} version:${{ matrix.platform[1] }} scheme:Showcase

- name: Run Tests
- if: ${{ matrix.platform[0] == 'watchOS' }}
name: Build Library
run: fastlane build platform:${{ matrix.platform[0] }} version:${{ matrix.platform[1] }} scheme:SwiftUIIntrospect

- if: ${{ matrix.platform[0] != 'watchOS' }}
name: Run Tests
run: fastlane test platform:${{ matrix.platform[0] }} version:${{ matrix.platform[1] }} scheme:SwiftUIIntrospectTests configuration:Debug

- if: ${{ matrix.platform[0] == 'iOS' && matrix.platform[1] <= '16' }}
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Changelog

## master

- Fixed: SwiftUI previews on watchOS no longer fail to build (#380)
- Infrastructure: fixed iOS 17 tests failing on CI (#381)

## [1.1.0]

- Removed: `Toggle` introspection on visionOS (#373)
Expand Down
2 changes: 2 additions & 0 deletions Sources/Introspect.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// The scope of introspection i.e. where introspect should look to find
Expand Down Expand Up @@ -214,3 +215,4 @@ extension NSWindow: PlatformEntity {
public typealias Base = NSWindow
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/IntrospectableViewType.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
public protocol IntrospectableViewType {
/// The scope of introspection for this particular view type, i.e. where introspect
/// should look to find the desired target view relative to the applied
Expand All @@ -15,3 +16,4 @@ public protocol IntrospectableViewType {
extension IntrospectableViewType {
public var scope: IntrospectionScope { .receiver }
}
#endif
2 changes: 2 additions & 0 deletions Sources/IntrospectionSelector.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
@_spi(Advanced)
public struct IntrospectionSelector<Target: PlatformEntity> {
@_spi(Advanced)
Expand Down Expand Up @@ -71,3 +72,4 @@ extension PlatformViewController {
return nil
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/IntrospectionView.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

typealias IntrospectionViewID = UUID
Expand Down Expand Up @@ -242,3 +243,4 @@ extension PlatformEntity {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/PlatformVersion.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import Foundation

@_spi(Internals)
Expand Down Expand Up @@ -309,3 +310,4 @@ extension visionOSVersion {
#endif
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/PlatformView.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

#if canImport(UIKit)
Expand Down Expand Up @@ -53,3 +54,4 @@ extension PlatformViewControllerRepresentable {
}
#endif
}
#endif
2 changes: 2 additions & 0 deletions Sources/PlatformViewVersion.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

public struct PlatformViewVersionPredicate<SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity> {
Expand Down Expand Up @@ -121,3 +122,4 @@ extension PlatformViewVersion: Comparable {
true
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/Button.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `Button` type in SwiftUI.
Expand Down Expand Up @@ -43,3 +44,4 @@ extension macOSViewVersion<ButtonType, NSButton> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/ColorPicker.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `ColorPicker` type in SwiftUI.
Expand Down Expand Up @@ -84,3 +85,4 @@ extension macOSViewVersion<ColorPickerType, NSColorWell> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/DatePicker.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `DatePicker` type in SwiftUI.
Expand Down Expand Up @@ -77,3 +78,4 @@ extension macOSViewVersion<DatePickerType, NSDatePicker> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/DatePickerWithCompactStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `DatePicker` type in SwiftUI, with `.compact` style.
Expand Down Expand Up @@ -89,3 +90,4 @@ extension macOSViewVersion<DatePickerWithCompactStyleType, NSDatePicker> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/DatePickerWithFieldStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `DatePicker` type in SwiftUI, with `.field` style.
Expand Down Expand Up @@ -50,3 +51,4 @@ extension macOSViewVersion<DatePickerWithFieldStyleType, NSDatePicker> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/DatePickerWithGraphicalStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `DatePicker` type in SwiftUI, with `.graphical` style.
Expand Down Expand Up @@ -87,3 +88,4 @@ extension macOSViewVersion<DatePickerWithGraphicalStyleType, NSDatePicker> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/DatePickerWithStepperFieldStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `DatePicker` type in SwiftUI, with `.stepperField` style.
Expand Down Expand Up @@ -50,3 +51,4 @@ extension macOSViewVersion<DatePickerWithStepperFieldStyleType, NSDatePicker> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/DatePickerWithWheelStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `DatePicker` type in SwiftUI, with `.wheel` style.
Expand Down Expand Up @@ -66,3 +67,4 @@ extension visionOSViewVersion<DatePickerWithWheelStyleType, UIDatePicker> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/Form.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `Form` type in SwiftUI.
Expand Down Expand Up @@ -91,3 +92,4 @@ extension visionOSViewVersion<FormType, UICollectionView> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/FormWithGroupedStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `Form` type in SwiftUI, with `.grouped` style.
Expand Down Expand Up @@ -124,3 +125,4 @@ extension macOSViewVersion<FormWithGroupedStyleType, NSScrollView> {
public static let v14 = Self(for: .v14)
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/FullScreenCover.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of `.fullScreenCover` in SwiftUI.
Expand Down Expand Up @@ -104,3 +105,4 @@ extension visionOSViewVersion<FullScreenCoverType, UIPresentationController> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/List.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `List` type in SwiftUI.
Expand Down Expand Up @@ -115,3 +116,4 @@ extension macOSViewVersion<ListType, NSTableView> {
public static let v14 = Self(for: .v14)
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/ListCell.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of a `List` cell type in SwiftUI.
Expand Down Expand Up @@ -112,3 +113,4 @@ extension macOSViewVersion<ListCellType, NSTableCellView> {
public static let v14 = Self(for: .v14)
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/ListWithBorderedStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `List` type in SwiftUI, with `.bordered` style.
Expand Down Expand Up @@ -54,3 +55,4 @@ extension macOSViewVersion<ListWithBorderedStyleType, NSTableView> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/ListWithGroupedStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `List` type in SwiftUI, with `.grouped` style.
Expand Down Expand Up @@ -98,3 +99,4 @@ extension visionOSViewVersion<ListWithGroupedStyleType, UICollectionView> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/ListWithInsetGroupedStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `List` type in SwiftUI, with `.insetGrouped` style.
Expand Down Expand Up @@ -77,3 +78,4 @@ extension visionOSViewVersion<ListWithInsetGroupedStyleType, UICollectionView> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/ListWithInsetStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `List` type in SwiftUI, with `.inset` style.
Expand Down Expand Up @@ -100,3 +101,4 @@ extension macOSViewVersion<ListWithInsetStyleType, NSTableView> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/ListWithSidebarStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `List` type in SwiftUI, with `.sidebar` style.
Expand Down Expand Up @@ -99,3 +100,4 @@ extension macOSViewVersion<ListWithSidebarStyleType, NSTableView> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/Map.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `Map` type in SwiftUI.
Expand Down Expand Up @@ -101,3 +102,4 @@ extension visionOSViewVersion<MapType, MKMapView> {
public static let v1 = Self(for: .v1)
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/NavigationSplitView.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `NavigationSplitView` type in SwiftUI.
Expand Down Expand Up @@ -128,3 +129,4 @@ extension macOSViewVersion<NavigationSplitViewType, NSSplitView> {
public static let v14 = Self(for: .v14)
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/NavigationStack.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `NavigationStack` type in SwiftUI.
Expand Down Expand Up @@ -97,3 +98,4 @@ extension visionOSViewVersion<NavigationStackType, UINavigationController> {
}
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/NavigationViewWithColumnsStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `NavigationView` type in SwiftUI, with `.columns` style.
Expand Down Expand Up @@ -116,3 +117,4 @@ extension macOSViewVersion<NavigationViewWithColumnsStyleType, NSSplitView> {
public static let v14 = Self(for: .v14)
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/NavigationViewWithStackStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `NavigationView` type in SwiftUI, with `.stack` style.
Expand Down Expand Up @@ -96,3 +97,4 @@ extension visionOSViewVersion<NavigationViewWithStackStyleType, UINavigationCont
}
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/PageControl.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the page control type in SwiftUI.
Expand Down Expand Up @@ -85,3 +86,4 @@ extension visionOSViewVersion<PageControlType, UIPageControl> {
public static let v1 = Self(for: .v1)
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/PickerWithMenuStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `Picker` type in SwiftUI, with `.menu` style.
Expand Down Expand Up @@ -55,3 +56,4 @@ extension macOSViewVersion<PickerWithMenuStyleType, NSPopUpButton> {
}
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/PickerWithSegmentedStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `Picker` type in SwiftUI, with `.segmented` style.
Expand Down Expand Up @@ -120,3 +121,4 @@ extension macOSViewVersion<PickerWithSegmentedStyleType, NSSegmentedControl> {
public static let v14 = Self(for: .v14)
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/ViewTypes/PickerWithWheelStyle.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(watchOS)
import SwiftUI

/// An abstract representation of the `Picker` type in SwiftUI, with `.wheel` style.
Expand Down Expand Up @@ -74,3 +75,4 @@ extension visionOSViewVersion<PickerWithWheelStyleType, UIPickerView> {
}
#endif
#endif
#endif
Loading