SwiftUI通过代码实现页面跳转

    let screnDelegate: UIWindowSceneDelegate? = {
                 var uiScreen: UIScene?
                 UIApplication.shared.connectedScenes.forEach { (screen) in
                     uiScreen = screen
                 }
                 return (uiScreen?.delegate as? UIWindowSceneDelegate)
             }()

   screnDelegate?.window!?.rootViewController  = UIHostingController(rootView: 页面View());

你可能感兴趣的:(SwiftUI通过代码实现页面跳转)