Instance Property

delegate

The object that processes incoming notifications and notification-related actions.

Declaration

weak var delegate: UNUserNotificationCenterDelegate? { get set }

Discussion

Use the delegate object to respond to user-selected actions and to process incoming notifications when your app is in the foreground. For example, you might use your delegate to silence notifications when your app is in the foreground.

To guarantee that your app responds to all actionable notifications, you must set the value of this property before your app finishes launching. For an iOS app, this means updating this property in the application(_:willFinishLaunchingWithOptions:) or application(_:didFinishLaunchingWithOptions:) method of the app delegate. Notifications that cause your app to be launched or delivered shortly after these methods finish executing.

For more information about implementing the delegate methods, see UNUserNotificationCenterDelegate.

See Also

Receiving Notifications and Handling Actions

protocol UNUserNotificationCenterDelegate

The interface for handling incoming notifications and notification-related actions.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software