Class

UNNotificationCategory

Defines the types of notifications your app supports and the custom actions displayed for each type.

Overview

A UNNotificationCategory object defines a type of notification that your executable can receive. You use category objects to implement actionable notifications—that is, notifications that have action buttons that 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.

You create category objects using the init(identifier:actions:intentIdentifiers:options:) method and register them using the singleton UNUserNotificationCenter object early in your executable’s life cycle. You can register as many category objects as you want. To take advantage of category objects, include the category’s identifier string in the payload of any notifications you create. For local notifications, you put this string in the categoryIdentifier property of the UNMutableNotificationContent object that you use to specify to specify the notification’s content. For remote notifications, you use this string as the value of the category key in the payload dictionary.

Categories can have associated actions, which when present define custom buttons displayed along with notifications of that category. Actions are stored in the actions property. When space is not limited, the system displays up to four actions. When space is limited, the system displays at most two actions.

Symbols

Creating a Notification Category

Getting the Category Information

var identifier: String

The unique string assigned to the category.

var actions: [UNNotificationAction]

The actions to display when a notification of this type is presented.

var intentIdentifiers: [String]

The intents related to notifications of this category.

var options: UNNotificationCategoryOptions

Options for how to handle notifications of this type.

Constants

UNNotificationCategoryOptions

Constants indicating how to handle notifications associated with this category.

Relationships

Inherits From