I have got a modal sheet built with SwiftUI
but the rest of my app is UIKit
. I want to display modal when user taps a button in UIKit
. How do I implement this?
Create a UIHostingController
with your SwiftUI view set as its rootView
, and present that as normal.
let hostingController = UIHostingController(rootView: MyModalView())
self.present(hostingController, animated: true, completion: nil)