Last active
April 24, 2017 14:46
-
-
Save roana0229/4e697c5a58c0c752fdf76d6ed50b8d75 to your computer and use it in GitHub Desktop.
AppCoordinatorのやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class AppCoordinator: Coordinator { | |
let window: UIWindow | |
lazy var feedCoordinator: FeedCoordinator = { | |
return FeedCoordinator(viewController: self.window.rootViewController!) | |
}() | |
init(window: UIWindow) { | |
self.window = window | |
} | |
func start() { | |
let viewController = SplashViewController.instantiate() | |
viewController.transitionsDelegate = self | |
window.rootViewController = viewController | |
window.makeKeyAndVisible() | |
} | |
} | |
extension AppCoordinator: SplashTransions { | |
func showHome() { | |
feedCoordinator.start() | |
} | |
func showLogin() { | |
window.rootViewController?.present(LoginViewController.instantiate(), animated: false, completion: nil) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
lazy var appCoordinator: AppCoordinator = { | |
return AppCoordinator(window: self.window!) | |
}() | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
window = UIWindow(frame: UIScreen.main.bounds) | |
appCoordinator.start() | |
return true | |
} | |
func applicationWillResignActive(_ application: UIApplication) { | |
} | |
func applicationDidEnterBackground(_ application: UIApplication) { | |
} | |
func applicationWillEnterForeground(_ application: UIApplication) { | |
} | |
func applicationDidBecomeActive(_ application: UIApplication) { | |
} | |
func applicationWillTerminate(_ application: UIApplication) { | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
class FeedCoordinator: Coordinator { | |
let presentingViewController: UIViewController | |
lazy var rootViewController: UIViewController = { | |
return FeedNavigationController.instantiate(storyboard: FeedViewController.className) | |
}() | |
init(viewController: UIViewController) { | |
self.presentingViewController = viewController | |
} | |
func start() { | |
presentingViewController.present(rootViewController, animated: false, completion: nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment