1 // Copyright 2015-present 650 Industries. All rights reserved. 2 3 import Foundation 4 5 @UIApplicationMain 6 class AppDelegate: UMAppDelegateWrapper { 7 var rootViewController: EXRootViewController? 8 9 override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { 10 if (application.applicationState != UIApplication.State.background) { 11 // App launched in foreground 12 setUpUserInterfaceForApplication(application, withLaunchOptions: launchOptions) 13 } 14 15 super.application(application, didFinishLaunchingWithOptions: launchOptions) 16 17 return true 18 } 19 20 override func applicationWillEnterForeground(_ application: UIApplication) { 21 setUpUserInterfaceForApplication(application, withLaunchOptions: nil) 22 super.applicationWillEnterForeground(application) 23 } 24 25 private func setUpUserInterfaceForApplication(_ application: UIApplication, withLaunchOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?) { 26 if (self.window != nil) { 27 return 28 } 29 30 ExpoKit.sharedInstance().registerRootViewControllerClass(EXRootViewController.self) 31 ExpoKit.sharedInstance().prepare(launchOptions: launchOptions) 32 33 window = UIWindow(frame: UIScreen.main.bounds) 34 window!.backgroundColor = UIColor.white 35 rootViewController = (ExpoKit.sharedInstance().rootViewController() as! EXRootViewController) 36 window!.rootViewController = rootViewController 37 38 window!.makeKeyAndVisible() 39 } 40 } 41