Skip to content

Instantly share code, notes, and snippets.

@Ravi61
Last active October 6, 2017 12:38
Show Gist options
  • Save Ravi61/d00996dd45b8c3572807570ae50d95b4 to your computer and use it in GitHub Desktop.
Save Ravi61/d00996dd45b8c3572807570ae50d95b4 to your computer and use it in GitHub Desktop.
Code for AppDelegate
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let delegator = ResponsibilityDelegator(workers: [UserNotificationAppDelegate(), LocationAppDelegate()])
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
delegator.application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
func applicationWillEnterForeground(_ application: UIApplication) {
delegator.applicationWillEnterForeground(application)
}
func applicationWillResignActive(_ application: UIApplication) {
delegator.applicationWillResignActive(application)
}
func applicationDidBecomeActive(_ application: UIApplication) {
delegator.applicationDidBecomeActive(application)
}
func applicationWillTerminate(_ application: UIApplication) {
delegator.applicationWillTerminate(application)
}
func applicationDidEnterBackground(_ application: UIApplication) {
delegator.applicationDidEnterBackground(application)
}
func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
delegator.application(application, didRegister: notificationSettings)
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
delegator.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
delegator.application(application, didReceiveRemoteNotification: userInfo)
}
func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
delegator.application(application, didReceive: notification)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment