Skip to content

Instantly share code, notes, and snippets.

@pgpt10
Created May 29, 2018 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgpt10/323ad332a45eaeda945fab3e178f6f2d to your computer and use it in GitHub Desktop.
Save pgpt10/323ad332a45eaeda945fab3e178f6f2d to your computer and use it in GitHub Desktop.
//Here you decide whether to silently handle the notification or still alert the user.
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
{
//Write you app specific code here
completionHandler([.alert, .sound]) //execute the provided completion handler block with the delivery option (if any) that you want the system to use. If you do not specify any options, the system silences the notification.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment