Created
January 29, 2019 15:14
-
-
Save sagaya/feac0fd529a61634011767542a4abe22 to your computer and use it in GitHub Desktop.
maincoordinator
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
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