Skip to content

Instantly share code, notes, and snippets.

@janodev
Created August 16, 2016 12:59
Show Gist options
  • Save janodev/06aff5b9430aa1a674c3c755baf92c57 to your computer and use it in GitHub Desktop.
Save janodev/06aff5b9430aa1a674c3c755baf92c57 to your computer and use it in GitHub Desktop.
Handle the notifications
@import UserNotifications;
extension NotificationManager: UNUserNotificationCenterDelegate
{
// Called because the user interacted with a notification. Actions may be dismiss, open, or choosing an action.
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: () -> Void)
{
print(response)
}
// Called because a notification was received while the app was in the foreground.
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void)
{
// delivers a notification to an app running in the foreground.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment