UNNotificationAction
A task your app performs in response to a notification that the system delivers.
Declaration
class UNNotificationActionMentioned in
Overview
Use UNNotificationAction objects to define the actions that your app can perform in response to a delivered notification. You define the actions that your app supports. For example, a meeting app might define actions for accepting or rejecting a meeting invitation. The action object itself contains the title to display in an action button and the button’s appearance. After creating action objects, add them to a UNNotificationCategory object and register your categories with the system.
For information on how to define actions and categories, see Declaring your actionable notification types.
Responding to the Selection of Actions
When the user selects one of your actions in response to a notification, the system notifies the delegate of the shared UNUserNotificationCenter object. Specifically, the system calls the userNotificationCenter(_:didReceive:withCompletionHandler:) method of your delegate object. The response object passed to your delegate includes the identifier string of the action the user selects, which you can use to perform the corresponding task.
For information on how to handle actions, see Handling notifications and notification-related actions.