Post

Replies

Boosts

Views

Activity

Reply to Using containerBackground with iOS16 deployment
That seems like it should work. I am using a very similar form without problem and I am deploying back to iOS 15 extension View { func widgetBackground(_ color: Color) -> some View { if #available(iOSApplicationExtension 17.0, macOSApplicationExtension 14.0, *) { return containerBackground(color, for: .widget) } else { return background(color) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Reply to Why is my widget drawn twice?
Home screen widgets are drawn twice per timeline entry: once for light mode and once for dark mode. That allows it to switch between the modes instantly without having to rerun the widget extension. Lock screen widgets are drawn many more times that that: they render once for every combination of: dark/light mode, vibrancy, privacy, etc.
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’22
Reply to iOS 17 StandBy Mode Opt Out for Widgets?
The thing you want to do is possible using disfavoredLocations(for:). https://developer.apple.com/documentation/swiftui/widgetconfiguration/disfavoredlocations(_:for:)
Replies
Boosts
Views
Activity
Sep ’23
Reply to Using containerBackground with iOS16 deployment
That seems like it should work. I am using a very similar form without problem and I am deploying back to iOS 15 extension View { func widgetBackground(_ color: Color) -> some View { if #available(iOSApplicationExtension 17.0, macOSApplicationExtension 14.0, *) { return containerBackground(color, for: .widget) } else { return background(color) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to Why is my widget drawn twice?
Home screen widgets are drawn twice per timeline entry: once for light mode and once for dark mode. That allows it to switch between the modes instantly without having to rerun the widget extension. Lock screen widgets are drawn many more times that that: they render once for every combination of: dark/light mode, vibrancy, privacy, etc.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to How can the image of the lock screen widget keep its original color (eg: color)?
That is not possible. Lock screen widgets, at least as of iOS 16 beta 4, always use the vibrant mode. That mode renders varying opacity with a frosted glass look based on the gray scale version of colors in the view. The other render modes are primarily meant for watchOS at this time. There is no way to show color in lock screen widgets.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’22