I want to check whether the widget is at Standby mode in TimelineProvider
.
I thought showsWidgetContainerBackground == false
means the widget is at Standby mode, referring to 'WWDC 2023 Bring widgets to new places'.
struct Provider: TimelineProvider {
func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
let isBackgroundShown = context.environmentVariants.showsWidgetContainerBackground // Error: Cannot assign to property: 'showsWidgetContainerBackground' is a get-only property
...
completion(timeline)
}
...
}
But in TimelineProvider
, I can't get context.environmentVariants.showsWidgetContainerBackground
because it is get-only property.
This is because context.environmentVariants
adopts @dynamicMemberLookup with WritableKeypath<EnvironmentValues, T>
.
Is there any chance to detect the widget is at Standby mode in TimelineProvider? Is it possible or not?
Any suggestion would be very grateful. Thank you.