Monday, September 30, 2024

What is UIHostingController?


UIHostingController- A UIKit view controller manages a SwiftUI view hierarchy. It is intended when integrating SwiftUI views into a UIKit view hierarchy.

 Present a SwiftUI view in the  UIKit view controller

let swiftCustomUIView = SwiftCustomUIView()
let hostingController = UIHostingController(rootView: swiftCustomUIView)
present(hostingController, animated: true, completion: nil)



No comments:

Create a list in SwiftUI with sticky section headers

 Sample Code import SwiftUI struct ContentView : View {     @State var isCustomViewControllerDisplayed = false     @State private va...