Skip to content

Instantly share code, notes, and snippets.

@suraphanL
Created September 11, 2016 17:33
Show Gist options
  • Save suraphanL/6361d64646fe455b685d1fe51645b3f1 to your computer and use it in GitHub Desktop.
Save suraphanL/6361d64646fe455b685d1fe51645b3f1 to your computer and use it in GitHub Desktop.
public protocol UNUserNotificationCenterDelegate : NSObjectProtocol {
// The method will be called on the delegate only if the application is in the foreground. If the method is not implemented or the handler is not called in a timely manner then the notification will not be presented. The application can choose to have the notification presented as a sound, badge, alert and/or in the notification list. This decision should be based on whether the information in the notification is otherwise visible to the user.
@available(iOS 10.0, *)
optional public func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Swift.Void)
// The method will be called on the delegate when the user responded to the notification by opening the application, dismissing the notification or choosing a UNNotificationAction. The delegate must be set before the application returns from applicationDidFinishLaunching:.
@available(iOS 10.0, *)
optional public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Swift.Void)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment