Post

Replies

Boosts

Views

Activity

Reply to Widget showsWidgetContainerBackground fallback
The below provides a quick and simple solution: private struct _ShowsWidgetContainerBackground: EnvironmentKey { static let defaultValue: Bool = true } extension EnvironmentValues { var showsWidgetContainerBackgroundWithFallback: Bool { get { if #available(iOSApplicationExtension 17.0, *) { self.showsWidgetContainerBackground } else { self[_ShowsWidgetContainerBackground.self] } } set {} } } You can use the new environment key showsWidgetContainerBackgroundWithFallback in place of showsWidgetContainerBackground.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’23
Reply to Widget showsWidgetContainerBackground fallback
The below provides a quick and simple solution: private struct _ShowsWidgetContainerBackground: EnvironmentKey { static let defaultValue: Bool = true } extension EnvironmentValues { var showsWidgetContainerBackgroundWithFallback: Bool { get { if #available(iOSApplicationExtension 17.0, *) { self.showsWidgetContainerBackground } else { self[_ShowsWidgetContainerBackground.self] } } set {} } } You can use the new environment key showsWidgetContainerBackgroundWithFallback in place of showsWidgetContainerBackground.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’23