In this lesson we create a ScreenNavigator implementation that is tied to our Activity. This will be bound in the Dagger graph and be provided whenever another object injects the ScreenNavigator type.
Hi Brandon, could we have used the navigation library in place on this sort of custom navigation implementation? If so what specific advantage does this way provide us over the navigation library.
The navigator in this class was really just a simple way to demonstrate an
@ActivityScope dependency; one that could be used in multiple different fragments.
So in short, no, I would not claim the navigation strategy in this app is better than Jetpack Navigation, or something like that.
That said, I do think custom navigation "libraries", whether they be wrappers around the framework/Jetpack navigation, or completely built from scratch, do have advantages. In general I prefer something on top of built-in/Jetpack navigation, but for smaller apps, I'm usually too lazy to implement anything like that :)