Relevant docs: https://developer.apple.com/documentation/widgetkit/timelinereloadpolicy
I don't understand how .atEnd
and .after
works and how they differ.
So here's what I want: I want to display my widget then update it in 5 seconds. Now I know these examples show that I can use the .after
policy like so:
let timeline = Timeline(
entries:[entry],
policy: .after(nextUpdateDate) // 5 seconds after now
)
But from reading the docs, .atEnd
means: "A policy that specifies that WidgetKit requests a new timeline after the last date in a timeline passes."
So why can't we do:
let timeline = Timeline(
entries:[entry1, entry2], // entry 2 has date 5 seconds after
policy: .atEnd
)
I tried this and it does not seem to work. When I say I tried, I just had an onAppear on my widget view to print out the entry dates, and the entry 5 seconds later never prints. So what does .atEnd actually do? What happens if we put .atEnd with 1 entry?