I am using an UIKit
app and added a widget with SwiftUI
and Widgetkit
.
Now I want to update the widget when the user does something one the main app.
Normally I should use WidgetCenter.shared.reloadAllTimelines()
right?
But this only works with SwiftUI
.
I could say that my widget should reload every second. But my widget does a json request. That would also do the json request every second which I don't want.
For you information. The Main app shares UserDefaults
with the widget. Depending on the UserDefaults
it reads it and changes it appearance.
Right now the widget loads the correct UserDefault when it is added first. But as I said changing the added Widget doesn't work.
I guess removing and adding the widget is not an userfriendly option.