archanger / LinkRouting

URL-based routing for SwiftUI
MIT License
8 stars 0 forks source link

No way to go back on navigator. #3

Open Arneoldenhave opened 1 month ago

Arneoldenhave commented 1 month ago

Hi archanger.

There seems to be no way to pop the path stack from custom back buttons. Since I include this package via SPM the path var is protected on the Navigators.

Would be nice to have a popLast and clear fn on the navigator :)

archanger commented 4 weeks ago

Hi @Arneoldenhave, and Thank you for being the pioneer in finding bugs and suggesting improvements in the package 😄

I kept the path internal for a reason. In my vision, in case of going back, it is enough to have @Environment(\.dismiss) var dismiss in a View and call it when needed or by calling another Link directly.

Could you please provide more details on the use case so we can find a solution?

Arneoldenhave commented 3 weeks ago

HI I was not aware of the environment dismiss var. I'll have a look shortly.

And it's my pleasure. I was working on building a string based router myself when I stumbled across your medium article. I had a look at the code and was impressed by its expressiveness. I decided to try and use your solution for the requirements that I have established earlier.

archanger commented 3 weeks ago

I find the library needs a crucial piece of functionality: deferred routing. It is very useful when a screen is required to do some job before navigating the Link path, e.g., the authorization screen.

It should not be a problem until you do not need to integrate real DeepLinks. But once a link becomes public and allows you to open any screen via a deep link, it becomes critical to make sure that the link is ready to be propagated further.

This will be a significant improvement; after that, I will be sure of readiness for production.

I appreciate all the feedback that you give; it helps to move forward and grow the maturity of the library 😃