Contents

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 -> NCUpdateResult

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.

See Also

Updating a Widget’s Contents