Created
November 18, 2018 08:52
-
-
Save laevandus/a325452ecefb32459acf11bf0c295e86 to your computer and use it in GitHub Desktop.
This file contains 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
final class LoginFlowController: UIResponder, LoginFlowPresenting { | |
let window: UIWindow | |
init(window: UIWindow) { | |
self.window = window | |
} | |
func showInitialView() { | |
let viewController = UIStoryboard.main.instantiateViewController(withIdentifier: "login") | |
(window.rootViewController as? UINavigationController)?.setViewControllers([viewController], animated: false) | |
} | |
func showSignUp() { | |
let viewController = SignUpViewController() | |
(window.rootViewController as? UINavigationController)?.pushViewController(viewController, animated: true) | |
} | |
func showAccountDetails() { | |
let viewController = UIStoryboard.main.instantiateViewController(withIdentifier: "accountdetails") | |
(window.rootViewController as? UINavigationController)?.pushViewController(viewController, animated: true) | |
} | |
} | |
protocol LoginFlowPresenting: FlowPresenting { | |
func showAccountDetails() | |
func showSignUp() | |
} | |
protocol LoginFlowControlling: FlowControlling { | |
var loginFlowController: LoginFlowPresenting { get } | |
} | |
extension LoginFlowControlling where Self: UIResponder { | |
var loginFlowController: LoginFlowPresenting { | |
return flowController() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment