Chapter 4 talks about how to transition from UIViewController’s to SwiftUI’s view by tapping a a push button. I wonder if we can go from SwiftUI’s view to a view controller by tapping a button like the following?
import SwiftUI
import UIKit
struct ContentView: View {
@State var goToViewController: Bool = false
var body: some View {
VStack {
Button(action: {
self.goToViewController.toggle()
}) {
Text(“Go to a view controller”)
}
}
}
}
I don’t see a good answer in the following stack overflow post.
Thanks.