|
Hi HWS-Fans, here is my problem:
How can I go back to Screen1 and reset the NavigationStack? Thanks for helping! |
|
If you watch Stewart Lynch video iOS 16 Navigation Stack - Back to Root and Deep Links. Remember that some changes to |
|
Hi! One way to solve this, well depending on what you need to do inside is like that. This is just one of the many options possible.
|
|
Yet another option using coordinator and enum for navigating, which I personally prefer, as more elegant way and coordination from one place. This one is using observable object so need import Observation framework.
|
|
|
|
A quetion to @ygeras about the coordinator you provided. Seems nice and decoupled but the question is how would you modify the "navigate" method to allow passing some dependencies to the screens? Because almost always you will have some object as a dependency for each screen so how would you achieve it? |
|
Hi there! Well currenly I can say there are several options to do that. All depends on what exactly you need to pass and how are the views interconnected i would say. Off the top of my head I can offer something like this:
PS. Actually in this example you don't need to pass the value in the method. The object will be accessible via @Environment. The proper way, to pass the data to the view is in the below post |
|
Another option is to inject the value into the view. Once again all depends on data you need to handle and pass. But there is a way to pass it around.
|
|
Yet another option that can be utilize I think is the associated value of enum structure. So hope those options will suffice :)
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.