我有 SwiftUI 页面,它是从 UIKit 视图导航的。我想为此页面设置标题,我正在做的是
// code of UIKit view
let controller = UIHostingController(rootView: SwiftUIView())
controller.title = "title"
MyNavigationManager.present(controller)
Run Code Online (Sandbox Code Playgroud)
有没有办法可以访问 SwiftUI 中的托管控制器?
然后我可以写这样的代码
self.hostingController?.title = "title"