Instance Method

widgetPerformUpdate(completionHandler:)

Called to give a widget an opportunity to update its contents.

Declaration

optional func widgetPerformUpdate(completionHandler: @escaping (NCUpdateResult) -> Void)

Parameters

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 NCUpdateResult that describes the result of the update procedure. (NCUpdateResult lists the possible values of result.)

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.