I am using pattern MVVM+Coordinator
. Every my controllers are created by coordinators
. But what is the correct way to stop my coordinators when tapping on back button of Navigation
Controller?
class InStoreMainCoordinator: NavigationCoordinatorType, HasDisposeBag {
let container: Container
enum InStoreMainChildCoordinator: String {
case menu = "Menu"
case locations = "Locations"
}
var navigationController: UINavigationController
var childCoordinators = [String: CoordinatorType]()
init(navigationController: UINavigationController, container: Container) {
self.navigationController = navigationController
self.container = container
}
func start() {
let inStoreMainViewModel = InStoreMainViewModel()
let inStoreMainController = InStoreMainController()
inStoreMainController.viewModel = inStoreMainViewModel
navigationController.pushViewController(inStoreMainController, animated: true)
}
}