Skip to content

Instantly share code, notes, and snippets.

@Ravi61
Last active October 6, 2017 12:35
Show Gist options
  • Save Ravi61/76e354c8311dd4faad5d76d00c097df0 to your computer and use it in GitHub Desktop.
Save Ravi61/76e354c8311dd4faad5d76d00c097df0 to your computer and use it in GitHub Desktop.
Code for UserNotificationDelegate
class UserNotificationAppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {
// check if app lauched via notification
return true
}
func applicationWillTerminate(_ application: UIApplication) {
// schedule a local notification
}
func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
// some code
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
// handle remote notification
}
func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
// handle local notification
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment