I have a widget in my app do like basic weather widget.
I want to refresh the content of the widget without let the user notice that.
And according to Apple documentation go to Updating Content they said:
To help your widget look up to date, the system occasionally captures snapshots of your widget’s view. When the widget becomes visible again, the most recent snapshot is displayed until the system replaces it with a live version of the view. To update a widget’s state before a snapshot is taken, be sure to conform to the NCWidgetProviding protocol.
So I use widgetPerformUpdate to update my widget content
but what happens is the app displays the "initial design" from the MainInterface.storboard until getting the data and update the screen, and each time I swipe left right I got the "initial design" until I got the data!
my code is :
func widgetPerformUpdate(completionHandler: (@escaping (NCUpdateResult) -> Void)) {
getWeatherInfo()
completionHandler(NCUpdateResult.newData)
}
anyone know what the problem and how to fix it?
Thanks.