Chapter 24 QuickTodo app - Push navigation instead of Pop Issues and my solution

Hi all,

so I have been playing with this QuickTodo project for a while and after spending about 10hrs to build an app that has 2 views one listing Object fetched from an API (one GET call) and then on selecting each item pushing (not Pop) to the new view and another GET call to show the detail. (basically I could have built this in an hour if I didn’t want to force myself to architect it same as the QuickTodo which I am really glad that I did that, worth the time) .

Anyway I had problem doing a push from a list. First of all as soon as I change the implementation to does push, it crashes since it needs to be on Main thread. fixing that then the other problem was, once pushing to new ViewController after tapping back and then pushing again it would crashes since it couldn’t find the NavigationController for the current controller.

Here is my code:

Terminology: Basically I have changed the Task to Contact :slight_smile:
You only need to check these Files: SceneCoordinator , SceneTransitionType, ContactViewModel, ContactListViewController and the Storyboard.

The commented parts are the one that if you replace with the current one would make the app crash.

Would love to know if my solution is good or is it a better way of doing it?

BTW, Thanks for the great book I really loved. I’ve been playing with SwiftBond and ReactiveKit for a while, but This RxSwift is AMAZING!!


I am having the same issue here. Problem is when using the BindableType and calling to bind the viewmodel to the controller it calls loadViewIfNeeded(). Which causes the view to be loaded in the life cycle before it gets the actual UINavigationController from being pushed. Normally when you call push on the navigation controller is when this loadViewIfNeeded() gets called. I have tried removing that in the BindableType and calling bindViewModel() in the viewDidLoad() which solves the problem of having a missing UINavigationController on the pushed controller, but then you have to make sure you call the scenecoordinator to pop. My nav bar seems messed up in this process though…