ios – SwiftUI – Dismiss modal after navigating by a number of screens


I’ve a stream that’s initially offered like this:

let vc = UIHostingController(rootView: SomeRootView())
vc.modalPresentationStyle = .fullScreen
current(vc, animated: true)

From that view/display screen, I can dismiss it by way of self.presentationMode.wrappedValue.dismiss()

Nevertheless, after navigating by a number of screens in that stream utilizing this type of factor:

NavigationLink(vacation spot: SomeOtherView(), isActive: $viewModel.shouldProceed) { EmptyView() }

After I dismiss from every other view, it simply goes again one stage within the navigation stack. What I need is to dismiss the whole nav stack. What is the cleanest method to do that? I have to have the choice to dismiss the whole stream at any level throughout the navigation.


Leave a Reply

Your email address will not be published. Required fields are marked *