We have limit timeline updates, why all the popular widget apps in the market get update at least every minute?

I have read I learnt that

  • WidgetKit Extension is not alive whenever the widget is visible

  • Updating every minute is far too aggressive. Widgets have a limited number of updates and if you were to try to update every minute, you'll quickly run out of updates.

But from my observation to those popular widget apps in the app store, they all manage to update widget every single minute precisely, not only the digital clock but also Analog clock.

If widget is a static snapshot, not alive, we are not allowed to provide a timer, and we also have limit timeline entry to update, why these apps are working?

Is there anything I missed reading, or is there anything missing from document?
Answered by pdpoblivion in 647838022
Widgets provide a Timeline of TimelineEntry objects, where each TimelineEntry object declares a Date property so it can be ordered in the Timeline. Providing multiple TimelineEntry objects isn't "updating" per se, updates happen when the Widget is asked for a new Timeline. Updating too frequently is discouraged, but Apple also recommends (somewhere in their docs or WWDC sessions, can't remember) to provide up to 24 hours of entries on each update when possible

I'm going to assume the app in question is providing a new entry for each minute, so the analog clock would visually update each minute, but otherwise the widget is only "updated" once (and returns one Timeline per day).
Accepted Answer
Widgets provide a Timeline of TimelineEntry objects, where each TimelineEntry object declares a Date property so it can be ordered in the Timeline. Providing multiple TimelineEntry objects isn't "updating" per se, updates happen when the Widget is asked for a new Timeline. Updating too frequently is discouraged, but Apple also recommends (somewhere in their docs or WWDC sessions, can't remember) to provide up to 24 hours of entries on each update when possible

I'm going to assume the app in question is providing a new entry for each minute, so the analog clock would visually update each minute, but otherwise the widget is only "updated" once (and returns one Timeline per day).
@pdpoblivion Thank you for the reply.

I tried by providing 60 timeline entries, one for each minute, and refresh timeline after one hour. It's updating, but not very accurate, it has few minutes delay.
Code Block
var updateDateTime = Date()
for _ in 1...60 {
entries.append(TimelineEntry(date: updateDateTime, record: record))
updateDateTime = Calendar.current.date(byAdding: .minute, value: 1, to: timelineDate)!
}
completion(Timeline(entries: entries, policy: .after(updateDateTime)))

Another way is provide one single entry for the timeline, and ask for refresh one minute later by using refresh policy .after(Date), it has few minutes delays to update as well. Anyway, from the tutorial, this policy is not for accurate update, it tells the earlier time that can refresh the timeline, so is the .atEnd policy.


It looks like Timeline is not a proper approach to achieve accurate time update. Maybe it's a timer inside widget view? Every widget app from app store, they can update time accurately, I think I must missed something.
We have limit timeline updates, why all the popular widget apps in the market get update at least every minute?
 
 
Q