My app is predominantly built in UIKit, however, I do have a few views created in SwiftUI.
I am presenting the SwiftUI view using a UIHostingController
and my intention is to present this view in full screen.
This is my code:
func present(swiftUIView view: AnyView) {
let viewController = UIHostingController(rootView: view)
viewController.modalPresentationStyle = .fullScreen
present(viewController)
}
The issue is that this doesn’t present the hosting view controller in full screen and still presents it in the default way:
What am I doing wrong and how can I present a SwiftUI view in fullscreen ?