I have been attempting to replace the info in my widget that’s fetched from CoreData, however the Widget solely refreshes once I run the venture for the primary time.
Neither the getTimeline, nor the getSnapshot features are being referred to as once I name the next perform from the app when the info is saved.
WidgetCenter.shared.reloadAllTimelines()
import WidgetKit
import SwiftUI
import Intents
import CoreData
struct Supplier: IntentTimelineProvider {
let topics = getData()
func placeholder(in context: Context) -> SimpleEntry {
SimpleEntry(date: Date(), topics: [], configuration: ConfigurationIntent())
}
func getSnapshot(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (SimpleEntry) -> ()) {
print("Snapshot referred to as")
let entry = SimpleEntry(date: Date(), topics: topics, configuration: configuration)
completion(entry)
}
func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
print("TimeLine referred to as")
let entry = SimpleEntry(date: Date(), topics: topics, configuration: configuration)
let timeline = Timeline(entries: [entry], coverage: .by no means)
completion(timeline)
}
}
struct SimpleEntry: TimelineEntry {
let date: Date
let topics: [Subject]
let configuration : ConfigurationIntent
}
If it helps, I had written some comparable code that labored completely earlier than on one other comparable app. I attempted uninstalling the app and downloading it once more, altering the timeline coverage from .by no means to .atEnd however it did not work.
I haven’t got any consumer configurable choices for the widget so I attempted eradicating the ConfigurationIntent references within the code, however it would not work.