Created
November 12, 2023 21:06
-
-
Save bolivarbryan/dc87a84f2d91408ec070fa40c632e3e7 to your computer and use it in GitHub Desktop.
Coordinator design pattern
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 | |
protocol Coordinator { | |
var parentCoordinator: Coordinator? { get set } | |
var children: [Coordinator] { get set } | |
var navigationController: UINavigationController { get set } | |
func start() | |
} | |
class AppCoordinator: Coordinator { | |
var parentCoordinator: Coordinator? | |
var children: [Coordinator] = [] | |
var navigationController: UINavigationController | |
init(navController: UINavigationController) { | |
self.navigationController = navController | |
} | |
func start() { | |
print("Running App Coordinator") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for using, go to AppDelegate and add:
Source:
https://medium.com/nerd-for-tech/mvvm-coordinators-ios-architecture-tutorial-fb27eaa36470