Hi Could you please help me out like to refresh the widget needs to be refreshed(need to hit the api and show the updated data) twice daily it at 6AM and 6PM. Right now am using the policy with .atEND But I could see the same data is rendering at 6AM and 6PM. and the refresh ie API call is happening after 6PM. But my requirement is like to hit the api before rendering the widget at 6AM and again needs to hit the api before rendering at 6PM.
if let At6AM = Calendar.current.date(bySettingHour: 6, minute: 0, second: 0, of: Date()) {
let refreshEntryFor6AM = RecommendedWidgetEntry(date: At6AM, recommedationData: items)
refreshEntries.append(refreshEntryFor6AM)
}
if let At6PM = Calendar.current.date(bySettingHour: 18, minute: 0, second: 0, of: Date()) {
let refreshEntryFor6PM = RecommendedWidgetEntry(date: At6PM, recommedationData: items)
refreshEntries.append(refreshEntryFor6PM)
}
let timeline = Timeline(entries: refreshEntries, policy: .atEnd)