Post

Replies

Boosts

Views

Activity

Reply to Widgets refreshing continuously, non-stop, not respecting timeline
Very simple! just put a timer in your getTimeline : func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> ()) { &#9;&#9;&#9;&#9;var entries: [SimpleEntry] = [] let&#9;entryDate = Calendar.current.date(byAdding: .second, value: 1 , to: Date())! &#9;&#9;&#9;&#9;&#9;&#9; let entry = SimpleEntry(date: entryDate, configuration: configuration) &#9;&#9;&#9; &#9;&#9;&#9;&#9;&#9;&#9;entries.append(entry) &#9;&#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;&#9;&#9;let timeline = Timeline(entries: entries, policy: .after(entryDate)) var timer = Timer() timer =&#9;Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (timer) in &#9;&#9;&#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;&#9;&#9;WidgetCenter.shared.reloadAllTimelines() &#9;&#9;&#9;&#9;&#9;&#9;completion(timeline) &#9;&#9;&#9;&#9;}
Oct ’20