Post

Replies

Boosts

Views

Activity

Reply to WidgetKit doesn't fetch updated data from Core Data when WidgetCenter.shared.reloadAllTimelines() gets called
Yep, same database for both Widget and the main app. It turns out all I had to do was update Core Data's context to the current store generation (in WidgetKit file, getTimeline() function) before making a fetch: try? Storage.viewContext.setQueryGenerationFrom(.current) Storage.viewContext.refreshAllObjects() Found the solution here: https://developer.apple.com/documentation/coredata/accessing_data_when_the_store_has_changed
Dec ’20