widgetPerformUpdate(completionHandler:)
Called to give a widget an opportunity to update its contents.
Declaration
optional func widgetPerformUpdate(completionHandler: @escaping @Sendable (NCUpdateResult) -> Void)optional func widgetPerformUpdate() async -> NCUpdateResultParameters
- completionHandler:
A block to be called when the widget’s content has been updated.
The block takes the following parameter:
- result
A value of type
NCUpdateResultthat describes the result of the update procedure. (Ncupdateresult lists the possible values ofresult.)
Discussion
This method is called to give a widget an opportunity to update its contents and redraw its view prior to an operation such as a snapshot. When the widget is finished updating its contents (and redrawing, if necessary), the widget should call the completion handler block, passing the appropriate NCUpdateResult value.