Post

Replies

Boosts

Views

Activity

Reply to SwiftUI presentationMode dismiss not work on specific case
I may have not got the issue correctly, but what I am making out of this problem is you are trying to dismiss ViewBInsideNavigationView using Navigation Views. But thats not how this code should be used. Navigation Views work like a tree, you create child views from root view, and when you go back, or dismiss the child view, you land BACK on the root view. As per Apple documentation - https://developer.apple.com/documentation/swiftui/environmentvalues/dismiss, you use dismiss( or PresentationMode) to Pop the current view from a Navigation stack. You are trying to dismiss root view here, because you have accessed presentationMode, on view where Navigation view starts, and trying to dismiss it. I don't think dismiss in Navigation views are supposed to work like that. Please go through the above documentation for proper use. PS: presentationMode is deprecated to dismiss in 17.0
Oct ’23