- 
                Notifications
    
You must be signed in to change notification settings  - Fork 473
 
Understanding the Application Lifecycle
        Kristian edited this page Dec 20, 2019 
        ·
        8 revisions
      
    TODO:
- Awaking from Push Notifications
 - Awaking from Location Changes
 
An iOS application can transition between the following states:
- Not running
 - Inactive (e.g. there is a phone call)
 - Active
 - Background
 - Suspended
 
Most of the time, your app reacts to state changes through the application delegate. If you are not using storyboards you will need to set up the window and root view controller of your application in application:didFinishLaunchingWithOptions:
For example:
    func application(application: UIApplication,
            didFinishLaunchingWithOptions launchOptions:[NSObject: AnyObject]?) -> Bool {
        
        self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
        self.rootViewController = ViewController()
        self.window?.rootViewController = self.rootViewController
        self.window?.makeKeyAndVisible()
        
        return true
    }If you are using a storyboard you simply specify the "main interface" in your project settings. (Remember to also set the initial view controller on the storyboard)
