Class

UNNotificationRequest

A request to schedule a local notification, which includes the content of the notification and the trigger conditions for delivery.

Declaration

class UNNotificationRequest : NSObject

Overview

Create a UNNotificationRequest object when you want to schedule the delivery of a local notification. A notification request object contains a UNNotificationContent object with the payload to be delivered, and it contains the UNNotificationTrigger object with the conditions that trigger the delivery of the notification. To schedule the delivery of your notification, pass your request object to the add(_:withCompletionHandler:) method of the shared user notification center object.

After scheduling a request, you interact with UNNotificationRequest objects in the following ways:

When receiving a local or remote notification, use the provided UNNotificationRequest object to fetch details about the notification.

Topics

Creating a Notification Request

init(identifier: String, content: UNNotificationContent, trigger: UNNotificationTrigger?)

Creates a notification request object that you use to schedule a notification.

Getting the Request Details

var identifier: String

The unique identifier for this notification request.

var content: UNNotificationContent

The content associated with the notification.

var trigger: UNNotificationTrigger?

The conditions that trigger the delivery of the notification.

Relationships

Inherits From

See Also

Notification Requests

Scheduling a Notification Locally from Your App

Create and schedule notifications from your app when you want to get the user's attention.

class UNNotification

The data for a local or remote notification that was delivered to your app.