I have configurable widget with dynamic options. The user can select different options like "Widget1" or "Widget2" (image). The data are provided by UserDefault and can be modified in the main app.
When I change tеxt for "Widget1" in the main app and do an update to widget (WidgetCenter.shared.reloadAllTimelines()
), the widget doesn't update its view and also selected option ("Widget1") is not selected anymore, until I select it again (and it will show the data I need).
Is it possible to update IntentHandler?
Any ideas are welcome! Thank you
IntentHadler file:
class IntentHandler: INExtension, ChooseWidgetIntentHandling {
func provideStylingOptionsCollection(for intent: ChooseWidgetIntent, with completion: @escaping (INObjectCollection<Styling>?, Error?) -> Void) {
let stylingConfiguration: [Styling] = Widget.array.map { widget in
let styling = Styling(identifier: widget.name, display: widget.name)
styling.text = widget.text
styling.category = widget.category as? NSNumber
return styling
}
let collection = INObjectCollection(items: stylingConfiguration)
completion(collection, nil)
}