fix: use canImport(WatchKit) guard for accessoryCorner, use -scheme in CI build
Some checks failed
PR → Build → Firebase OTA → LGTM / Build & Deploy to Firebase OTA (pull_request) Failing after 2m8s
PR → Build → Firebase OTA → LGTM / Wait for LGTM comment (pull_request) Has been skipped

- Replace #if os(watchOS) with #if canImport(WatchKit) for all .accessoryCorner
  usages. When the CI builds with forced iphoneos SDK, os(watchOS) evaluates
  to true (target platform is watchOS) but the SDK doesn't have WatchKit, so
  accessoryCorner is unavailable. canImport(WatchKit) correctly checks SDK
  availability rather than target platform.

- Wrap CornerComplicationView struct and its preview in #if canImport(WatchKit)
  with @available(watchOS 10.0, *) annotation.

- Change CI build from -target TabataGo -sdk iphoneos to -scheme TabataGo
  (without -sdk). This lets xcodebuild pick the correct SDK per target:
  iphoneos for iOS, watchos for watchOS. The scheme already exists in
  project.yml.
This commit is contained in:
2026-06-26 23:39:38 +00:00
parent a6ea4ca904
commit 60ac624487
2 changed files with 15 additions and 4 deletions

View File

@@ -58,8 +58,7 @@ jobs:
xcodebuild -list
xcodebuild build \
-project TabataGo.xcodeproj \
-target TabataGo \
-sdk iphoneos \
-scheme TabataGo \
-destination "generic/platform=iOS" \
-configuration Debug \
-allowProvisioningUpdates \

View File

@@ -98,6 +98,8 @@ struct RectangularComplicationView: View {
}
/// `.accessoryCorner` tiny bolt + streak digit in the corner
#if canImport(WatchKit)
@available(watchOS 10.0, *)
struct CornerComplicationView: View {
let entry: TabataEntry
@@ -111,6 +113,7 @@ struct CornerComplicationView: View {
.widgetLabel(String(format: String(localized: LocalizedStringResource("watch.complication.dayStreakFmt")), entry.streak))
}
}
#endif
// Widget definition
@@ -127,7 +130,7 @@ struct TabataGoComplication: Widget {
.supportedFamilies([
.accessoryCircular,
.accessoryRectangular,
#if os(watchOS)
#if canImport(WatchKit)
.accessoryCorner
#endif
])
@@ -144,7 +147,7 @@ struct TabataComplicationEntryView: View {
CircularComplicationView(entry: entry)
case .accessoryRectangular:
RectangularComplicationView(entry: entry)
#if os(watchOS)
#if canImport(WatchKit)
case .accessoryCorner:
CornerComplicationView(entry: entry)
#endif
@@ -167,3 +170,12 @@ struct TabataComplicationEntryView: View {
} timeline: {
TabataEntry(date: .now, streak: 7, lastWorkoutLabel: "Today")
}
#if canImport(WatchKit)
@available(watchOS 10.0, *)
#Preview("Corner", as: .accessoryCorner) {
TabataGoComplication()
} timeline: {
TabataEntry(date: .now, streak: 7, lastWorkoutLabel: "Today")
}
#endif