我有一个通过场景代理实例化的 SwiftUI View
,它被包含在一个 UINavigationController
中。
我想从这个 SwiftUI View
推出另一个 UIViewController
。
下面是我的场景代理代码,展示了如何实例化我的 View
:
let vc = UIHostingController(rootView:SwiftUIView())
let navigationControll = UINavigationController(rootViewController: vc)
self.window?.rootViewController = navigationControll
// Present window to screen
self.window?.makeKeyAndVisible()
我该如何实现这个?
NavigationLink
似乎仍然不稳定。如果使用UIKit中的UINavigationController
作为基础容器,并且使用SwiftUI视图作为内容视图更方便制作任何想要的视图,那么我更喜欢使用它。 - Kyokook Hwang