
Widgets can be configurable right on the Home Screen. This means "atEnd" and "after" represent the earliest times a widget can be refreshed. In order to provide the best user experience, and provide widgets updates as close to when the user will see them as possible, the system intelligently schedules updates. Note that there may be many timelines active in the system at a time, each with its own reload policy. It is up to us to explicitly tell the widget when to reload via the widget center API.
Alternote widget update#
Our last option is "never." "Never" means that the system will not independently update a widget. Then, WidgetKit will schedule an update for 10:00 PM, regardless of how far in the future or past other entries in the timeline are. Let's say we passed in an after date of 10:00 PM. Similarly, "after" tells WidgetKit to start scheduling an update at the date provided. When that update happens, our timeline method will be called again, allowing us to return more entries. The first one, atEnd, tells WidgetKit that when the last entry of a timeline is displayed, to start scheduling an update. The big question is what happens at the end? How do we provide more entries? The answer is that we pick a TimelineReloadPolicy. As we saw in Part 1, the timeline provider is the engine of the widget. If you've built a complication before, these are the same in concept as complication families. There are three families provided by WidgetKit, systemSmall, systemMedium, and systemLarge. It sounds like a lot, but the power of SwiftUI combined with WidgetKit really makes each step simple and straightforward. And we'll update our widget to do all of this. We'll talk about how a widget can link to content in its app.
Alternote widget how to#
We'll go over how to make a widget user configurable. We'll cover timelines and how to update them. If you built a watchOS complication before, this will sound familiar.

We'll talk about widget families and what they are. I'm an engineer on the iOS System Experience team. Have a question? Ask with tag wwdc20-10035.

