---
title: "widgetPerformUpdate(completionHandler:)"
framework: notificationcenter
role: symbol
role_heading: Instance Method
path: "notificationcenter/ncwidgetproviding/widgetperformupdate(completionhandler:)"
---

# widgetPerformUpdate(completionHandler:)

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

## Declaration

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

```swift
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:

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: optional func widgetPerformUpdate() async -> NCUpdateResult For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. 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

- [NCUpdateResult](notificationcenter/ncupdateresult.md)
