I have three controllers and one swiftUI view, below is the flow
A Controller(RootController) -> B controller – > C controller -> SwiftUI view
I am doing some operation on the SwiftUI view based on the operation need to decide to whether pop back to C controller or B. Currently I am able pop back to C Controller and root controller, not sure how to jump to specific (in my case B controller)controller in SwiftUI
.navigationBarItems(leading:Button(action: {
self.presentationMode.wrappedValue.dismiss()
})
I mean to say instead of this line self.presentationMode.wrappedValue.dismiss()
is there any method to pass view controller to pop back
2
Answers
You can make an extension for UINavigationController
and use it like this
or
@OhStack just import UIKit (Personally i’m using a router/coordinator for navigation, and there I include UIKit)