<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 10.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UserNotificationsUI",
  "identifier" : "/documentation/UserNotificationsUI/UNNotificationContentExtension/didReceive(_:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "User Notifications UI"
    ],
    "preciseIdentifier" : "c:objc(pl)UNNotificationContentExtension(im)didReceiveNotificationResponse:completionHandler:"
  },
  "title" : "didReceive(_:completionHandler:)"
}
-->

# didReceive(_:completionHandler:)

Handles a notification action selected by the user.

```
optional func didReceive(_ response: UNNotificationResponse, completionHandler completion: @escaping @Sendable (UNNotificationContentExtensionResponseOption) -> Void)
```

## Parameters

`response`

The response object that identifies the user-selected action.
Use this object to get information about the notification and the user’s
response.

`completion`

The block to execute when you are finished performing the
action. You must call this block at some point during your implementation.
The block has no return value and takes the following parameter:

- `dismiss`: The response you want to take for the notification. For a list of
  possible options, see
  [`UNNotificationContentExtensionResponseOption`](/documentation/UserNotificationsUI/UNNotificationContentExtensionResponseOption).

## Discussion

Implement this method when you want your view controller to handle actions
selected by the user. Use your implementation to perform the associated task
and then execute the `completion` block. If you implement this method, you
must handle all actions defined in all categories managed by your
Notification Content app extension. If you don’t implement this method, the
system notifies your app when the user selects an action.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)