PushNotificationDelegate
public protocol PushNotificationDelegate : AnyObject, Sendable
Protocol to be implemented by push notification clients. All methods are optional.
-
receivedForegroundNotification(_:
Asynchronous) Called when a notification is received in the foreground.
Declaration
Swift
@MainActor func receivedForegroundNotification(_ userInfo: [AnyHashable : Any]) async
Parameters
userInfo
The notification info
-
receivedBackgroundNotification(_:
Asynchronous) Called when a notification is received in the background.
Declaration
Swift
@MainActor func receivedBackgroundNotification(_ userInfo: [AnyHashable : Any]) async -> UIBackgroundFetchResult
Parameters
userInfo
The notification info
-
Called when a notification is received in the background.
-
receivedNotificationResponse(_:
Asynchronous) Called when a notification is received in the background or foreground and results in a user interaction. User interactions can include launching the application from the push, or using an interactive control on the notification interface such as a button or text field.
Declaration
Swift
@MainActor func receivedNotificationResponse(_ notificationResponse: UNNotificationResponse) async
Parameters
notificationResponse
UNNotificationResponse object representing the user’s response to the notification and the associated notification contents.
-
extendPresentationOptions(_:
Asynchronousnotification: ) Called when a notification has arrived in the foreground and is available for display.
Declaration
Swift
@MainActor func extendPresentationOptions( _ options: UNNotificationPresentationOptions, notification: UNNotification ) async -> UNNotificationPresentationOptions
Parameters
options
The notification presentation options.
notification
The notification.