Last active
August 21, 2019 05:59
-
-
Save susanna2222/84f60d92e2bbc22951e9f4922ec128fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import CoreLocation | |
import UserNotifications | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate, UNUserNotificationCenterDelegate{ | |
var window: UIWindow? | |
let locationManager = CLLocationManager() | |
let notificationCenter = UNUserNotificationCenter.current() | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
return true | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// called if app is running in foreground | |
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { | |
// show alert while app is running in foreground | |
return completionHandler(UNNotificationPresentationOptions.alert) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment