As we know Apple have introduced NavigationStack in SwiftUI available from iOS16.*
Let say I have created ViewA, ViewB, ViewC, ViewD
And now I have navigated like ViewA->ViewB->ViewC->ViewD
Now I am looking to pop to root view i.e on ViewA from ViewD
Any help would be appreciated.
This worked for me but I can't find the url so I will just share the code. You can also try it out...
Create a file and add the following;
Then call this from anywhere in your code;