我试图在用户注销后将 rootview 控制器更改为不同的屏幕。
if let window = UIApplication.shared.windows.first {
window.rootViewController = UIHostingController(rootView: SignInView())
window.endEditing(true)
window.makeKeyAndVisible()
}
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止所拥有的。它导航到不同的视图,但它使新视图上的按钮无法使用。有没有更好的方法来更改 rootview 或者我错过了什么?