跳到主要内容

框架集成 - UIKit 中的 SwiftUI

UIHostingController​

代表 SwiftUI 视图的 UIViewController。

let vc = UIHostingController(rootView: Text("Hello World"))
let vc = UIHostingController(rootView: ContentView())

文档 - UIHostingController