fix: use canImport(WatchKit) guard for accessoryCorner, use -scheme in CI build
- 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user