WidgetKit refresh policy

It's my understanding that the refresh of the timelines aren't going to be exactly at the end times, but approximately around there. But is it expected that it could be wildly off?

I'm testing out scenarios where it refreshes after a date, but sometimes it gets refreshed an hour or 2 later. Sometimes even before the refresh date.

I'm using both .atEnd and .after date and seeing similar results. Trying to implement something where the user can set how often they see the updated widget and it's really unreliable.
It's hard to know exactly when the system calls the widget timelines request or view rendering. It has happened to me too. The reason is that
  1. Either this is due to the beta version of Xcode. In earlier betas like beta 1, the timeline function sometimes did not get called at all for me. But in later betas, the timeline function got called, its an on and off situation. But one thing I have observed in the beta is that the refresh didn't happen at the exact moment of he timeline that I have passed.

  2. Or either it could be that way that these widgets work. Sometimes a widget is not deemed to be that important. Maybe the widget was not intensively used/viewed by the user. I have no clue on how apple does it, maybe machine learning, but that thing is that system will call the timelines method based on the apps frequency count or based on widgets usage.

Another thing to be aware of, is that the system has a floor to how frequently it will allow you to refresh the widget. I have no idea what all might go into the decision process but I did some testing with my widgets and on Beta 4 it seems like with a configured refresh rate of 5 seconds (this is way too short, never actually do this) the actual refresh rates is roughly every 5 minutes when the screen is active and the widget is visible or every 15 minutes with the phone screen turned off.
This seems particularly rubbish, to be honest.
  • They've given us a countdown timer: Text.init(aDate, style: .timer)

  • You can't style it, so it counts down in hours, minutes and seconds regardless of how many days there are, i.e. "36:34:56" instead of something more friendly like"1 day 12:34:56" or "1d:12h:34m:56s" etc.

  • Once that countdown timer hits 0:00:00 and you want the timeline to reload and do something, you have to wait for about 5 minutes because TimelineReloadPolicy.atEnd and .after(date:) don't actually trigger at the time you set them to.

  • Is there much point having these reload policies if they don't trigger when you need them to?

Are these things beyond the abilities of the Apple developers, or is there some special setting I've missed?
WidgetKit refresh policy
 
 
Q