NetNewsWire/iOS/SceneDelegate.swift

48 lines
1.3 KiB
Swift
Raw Normal View History

2019-06-28 17:28:02 +02:00
//
// AppDelegate.swift
// NetNewsWire
//
// Created by Maurice Parker on 6/28/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
2019-06-28 17:28:02 +02:00
var window: UIWindow?
2019-07-19 22:59:46 +02:00
var coordinator = AppCoordinator()
2019-06-28 17:28:02 +02:00
// UIWindowScene delegate
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
window = UIWindow(windowScene: scene as! UIWindowScene)
2019-06-28 17:28:02 +02:00
window!.tintColor = AppAssets.netNewsWireBlueColor
window!.rootViewController = coordinator.start()
window!.makeKeyAndVisible()
2019-06-28 17:28:02 +02:00
if let userActivity = connectionOptions.userActivities.first ?? session.stateRestorationActivity {
DispatchQueue.main.asyncAfter(deadline: .now()) {
self.coordinator.handle(userActivity)
}
}
2019-06-28 17:28:02 +02:00
}
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
coordinator.handle(userActivity)
}
2019-06-28 17:28:02 +02:00
func sceneDidEnterBackground(_ scene: UIScene) {
appDelegate.prepareAccountsForBackground()
}
func sceneWillEnterForeground(_ scene: UIScene) {
appDelegate.prepareAccountsForForeground()
}
// func stateRestorationActivity(for scene: UIScene) -> NSUserActivity? {
// return scene.userActivity
// }
}