Open a ViewController from Swift UI button

Hi,

I state that I am a self-taught developer, so I apologize if I will ask you some trivial questions.
I developed an app in UIkit, but later decided to use Swift UI for the main grafic interface, implementing it on a HostingViewController. I wanted to ask if and how it is possible to make a button (SwiftUI button) open another ViewController (based on UiKit)

Thanks guys :)
Answered by Claude31 in 642618022
You should use a navigationLink.
  1. wrap your UIKit VC in a Swift:

https ://www.hackingwithswift. com/books/ios-swiftui/wrapping-a-uiviewcontroller-in-a-swiftui-view

2. Call through navigationLink:
https://stackoverflow.com/questions/56437335/go-to-a-new-view-using-swiftui
Accepted Answer
You should use a navigationLink.
  1. wrap your UIKit VC in a Swift:

https ://www.hackingwithswift. com/books/ios-swiftui/wrapping-a-uiviewcontroller-in-a-swiftui-view

2. Call through navigationLink:
https://stackoverflow.com/questions/56437335/go-to-a-new-view-using-swiftui
Open a ViewController from Swift UI button
 
 
Q