Enable Mac Catalyst on both targets; make the widget intent parameter optional

Supported Destinations now includes Mac (Mac Catalyst) on the app and the
widget extension. Catalyst requires the iPad device family, so both targets
move to TARGETED_DEVICE_FAMILY "1,2".

The first Catalyst build failed on CalendarSelectionIntent: WidgetConfigurationIntent
requires every @Parameter to be optional, and the macOS SDK enforces that where
the iOS one lets a bare array through. selectedCalendars is now optional.

Behaviour is unchanged — the timeline provider already treated an empty
selection as "show all calendars", so nil folds into the same path.

Verified: builds for both Mac Catalyst and iOS Simulator.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-08-10 16:57:10 +02:00
parent c9bd42aae5
commit 7fa8dbdbdf
3 changed files with 21 additions and 16 deletions

View File

@@ -32,11 +32,16 @@ struct CalendarEntityQuery: EntityQuery {
}
/// Widget configuration intent: lets the user pick which calendars to show.
/// An empty selection means "show all calendars" (the default).
/// No selection means "show all calendars" (the default).
///
/// The parameter must be optional: WidgetConfigurationIntent requires every
/// parameter type to be optional, and the macOS/Mac Catalyst SDK enforces that
/// where the iOS one lets a bare array through. `nil` and `[]` are treated
/// alike downstream, so this is behaviour-preserving.
struct CalendarSelectionIntent: WidgetConfigurationIntent {
static var title: LocalizedStringResource = "Kalender auswählen"
static var description = IntentDescription("Wähle welche Kalender im Widget angezeigt werden. Leer = alle Kalender.")
@Parameter(title: "Kalender")
var selectedCalendars: [CalendarAppEntity]
var selectedCalendars: [CalendarAppEntity]?
}

View File

@@ -38,8 +38,8 @@ struct CalendarrTimelineProvider: AppIntentTimelineProvider {
private func filtered(_ snapshot: WidgetSnapshot?, by config: CalendarSelectionIntent) -> WidgetSnapshot? {
guard let snapshot else { return nil }
let ids = config.selectedCalendars.map { $0.id }
guard !ids.isEmpty else { return snapshot } // empty = show all
let ids = (config.selectedCalendars ?? []).map { $0.id }
guard !ids.isEmpty else { return snapshot } // nothing selected = show all
let keep = Set(ids)
return WidgetSnapshot(
writtenAt: snapshot.writtenAt,