Closed hmlongco closed 11 months ago
You could definitely create a router object that handles navigation the way you're suggesting. Or my preferred way is by injecting the router object into the viewModel and the viewModel specifies how to handle navigation. I provided an MVVM example in the README for how to do this.
From my perspective, one of the primary functions of a router is to decouple the presentation methodology.
IOW, the code says "I want to display a payment screen." That code shouldn't care if the payment screen is added to the stack, or presented in a modal sheet or In a full-screen cover.
Whereas this code is explicitly defining the process from within the view.
What if you had...
And then add some additional mechanism for the Route to determine the proper course of action?
(Added this as Issue since Discussions not enabled for the project.)