I have a simple widget that needs to be updated daily, however many of the users have complained that their widget doesn't update daily.
What am doing wrong here?
func getTimeline(in context: Context, completion: @escaping (Timeline<TodayInfoEntry>) -> Void) {
let now = Date() + 2
widgtBrain.date = now
let nextUpdateDate = Calendar.autoupdatingCurrent.date(byAdding: .day, value: 1, to: Calendar.autoupdatingCurrent.startOfDay(for: now))!
let todayInfo = widgtBrain.widgetInfoDicGenerator(forActualWidget: true, forPlaceholder: false, forSnapshot: false)
let entry = TodayInfoEntry(
date: now,
info: todayInfo
)
let timeline = Timeline(
entries:[entry],
policy: .after(nextUpdateDate)
)
completion(timeline)
}
the widgetBrain generates a dictionary with new data based on the given date "now"