[ad_1]
I’ve a two ViewControllers A and B and a SwiftUI view, navigating from “A” controller to SwiftUIview inside this carried out NavigationLink to navigate -> “B” controller. Attempting to pop again to Controller “A” from “B” skipping SwiftUI in between
under resolution will not be working
.onDisappear tried one thing like this presentationMode.wrappedValue.dismiss()
On A ViewController
func integrateSwiftUIView() {
let hostingController = UIHostingController(rootView: swiftUIView)
addChild(hostingController)
view.addSubview(hostingController.view)
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
let constraints = [
hostingController.view.topAnchor.constraint(equalTo: view.topAnchor),
hostingController.view.leftAnchor.constraint(equalTo: view.leftAnchor),
view.bottomAnchor.constraint(equalTo: hostingController.view.bottomAnchor),
view.rightAnchor.constraint(equalTo: hostingController.view.rightAnchor)
]
NSLayoutConstraint.activate(constraints)
hostingController.didMove(toParent: self)
}
On integrateSwiftUIView utilizing UIViewControllerRepresentable to succeed in BViewController
NavigationLink(isActive: $isPresented) {
LaunchBViewController()
}) {
}
- Pop again on to AViewController from BViewController
- Dismiss SwiftUIView
[ad_2]
