I want to refresh my widget every day at midnight. I'm getting the date with
and passing it to my TimeLine
completion(Timeline(entries: entries, policy: .after(nextMidnight)))
but when I reach this date, my widget doesn't refresh. I've also received reports from Testflight users of my app that say they see a "-1 Day" label in my widget, which sounds like the view of the widget refreshed before fetching a new timeline with an entry for the next day.
I tested widget refresh from actually being up til after midnight, and by changing the clock on the phone to 11:5X and waiting, never seeing a change or code executed when attached to Xcode.
Code Block let currentDate = Date() let midnight = Calendar.current.startOfDay(for: currentDate) let nextMidnight = Calendar.current.date(byAdding: .day, value: 1, to: midnight)!
and passing it to my TimeLine
completion(Timeline(entries: entries, policy: .after(nextMidnight)))
but when I reach this date, my widget doesn't refresh. I've also received reports from Testflight users of my app that say they see a "-1 Day" label in my widget, which sounds like the view of the widget refreshed before fetching a new timeline with an entry for the next day.
I tested widget refresh from actually being up til after midnight, and by changing the clock on the phone to 11:5X and waiting, never seeing a change or code executed when attached to Xcode.