I've send the following to pauls email. After I found this forum :/ Guess sometimes you cant see the tree in the forest.
I try to learn more about navigation and your articles of the coordinators are great. Though I can’t make it work.
You can have a look at the project at https://github.com/GlennDrescher/Disputea
When I create a new Xcode Project I also have Scene Delegate. Maybe that has something to do with it?
When I finish the first video about Coordinators I end up with the 2 buttons which do nothing and no navigation bar at the top.
Could you tell me why the buttons are not changing the View?
Another question:
What if I want to use Coordinations with optional Navigation controller.
For example in the case of Login screen you likely don’t want a back button.
Another thing:
Instead of:
func start() {
let vc = ViewController.instantiate()
vc.coordinator = self
navigationController.pushViewController(vc, animated: false)
}
func login() {
let vc = Login.instantiate()
vc.coordinator = self
navigationController.pushViewController(vc, animated: true)
}
func ChatroomList() {
let vc = ChatroomsList.instantiate()
vc.coordinator = self
navigationController.pushViewController(vc, animated: true)
}
I would love to have something less “smelly” like:
func navigate(to page: UIViewController, animated: bool, navigation: bool) {
let vc = page.instantiate()
vc.coordinator = self
if navigation {
navigationController.pushViewController(vc, animated: animated)
}
}
navigate(to: Login, animated: true, navigation: false)
<- this could be a cool way to navigate anywhere and choose if you want to push it to the navigation controller or not. But maybe the navigation aspect could better be per Coordinator, like “this section / coordinator has navigation the other don’t"
Any idea why this is not working? I tried with Storyboarded which would be more specific, but then it complaints something about self and it doesn’t work either.
So basically 3 questions:
- Why is my project not changing the view and not showing the navigationController bar atop?
- How to implement coordinators without navigationbar?
- How to navigate anywhere with just one methode instead of duplicated code?