Skip to content

Instantly share code, notes, and snippets.

@styrken
Created December 12, 2019 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save styrken/65322bba65a5ec41dc9ebc76e11c3348 to your computer and use it in GitHub Desktop.
Save styrken/65322bba65a5ec41dc9ebc76e11c3348 to your computer and use it in GitHub Desktop.
//
// AppDelegate.swift
//
// Created by Rasmus Styrk on 12/12/2019.
// Copyright © 2019 Rasmus Styrk. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var appCordinator: AppCordinator?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
if #available(iOS 13.0, *) {
// On IOS 13 we use the UISceneSession
} else {
let repository = DataRepositoryFactory().repository()
let sessionManager = SessionManager(repository: repository)
self.window = UIWindow(frame: UIScreen.main.bounds)
self.appCordinator = AppCordinator(window: self.window!,
repository: repository,
sessionManager: sessionManager)
self.appCordinator?.start()
}
return true
}
// MARK: UISceneSession Lifecycle
@available(iOS 13.0, *)
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
@available(iOS 13.0, *)
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return ApplicationDelegate.shared.application(app, open: url, options: options)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment