UNNotificationCategory
A type of notification your app supports and the custom actions that the system displays.
Declaration
class UNNotificationCategoryMentioned in
Overview
A UNNotificationCategory object defines a type of notification that your executable can receive. You create category objects to define your app’s actionable notifications — notifications that have action buttons the user can select in response to the notification. Each category object you create stores the actions and other behaviors associated with a specific type of notification. Register your category objects using the setNotificationCategories(_:) method of UNUserNotificationCenter. You can register as many category objects as you need.
To apply category objects to your notifications, include the category’s identifier string in the payload of any notifications you create. For local notifications, put this string in the categoryIdentifier property of the UNMutableNotificationContent object that you use to specify the notification’s content. For remote notifications, use this string as the value of the category key in the aps dictionary of your payload.
Categories can have associated actions, which define custom buttons the system displays for notifications of that category. When the system has unlimited space, the system displays up to 10 actions. When the system has limited space, the system displays at most two actions.
Topics
Essentials
init(identifier:actions:intentIdentifiers:options:)init(identifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:options:)init(identifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:categorySummaryFormat:options:)