Post

Replies

Boosts

Views

Activity

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 Widget Not Refreshing.
I don't know if this is the full code or reduced for display but there are a couple things I would suggest looking at: Your View is not valid. You can't put a bunch of Text() views directly in the body. Try putting a VStack around the ForEach loop. Inside of the dataTask block, make sure that the data object is not nil. You are force unwrapping the optional, but without ever making sure that it isn't nil.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’21