Skip to content

Instantly share code, notes, and snippets.

@sagaya
Created January 29, 2019 15:14
Show Gist options
  • Save sagaya/feac0fd529a61634011767542a4abe22 to your computer and use it in GitHub Desktop.
Save sagaya/feac0fd529a61634011767542a4abe22 to your computer and use it in GitHub Desktop.
maincoordinator
class MainCoordinator: Coordinator {
var childCoodinators = [Coordinator]()
var navigationController: UINavigationController
fileprivate var isLoggedIn = false
init(navigationController: UINavigationController) {
self.navigationController = navigationController
}
func start() {
if isLoggedIn {
showHomeScreen()
} else {
showLoginScreen()
}
}
func showHomeScreen(){
let homeCoordinator = HomeCoordinator(navigationController: navigationController)
homeCoordinator.delegate = self
homeCoordinator.start()
childCoodinators.append(homeCoordinator)
}
func showLoginScreen(){
let loginCoordinator = AuthenticationCoordinator(navigationController: navigationController)
loginCoordinator.delegate = self
loginCoordinator.start()
childCoodinators.append(loginCoordinator)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment