我工作到登录view
,现在我要介绍 view
登录后,但我不希望用户有可能返回登录view
.在 UIkit
我用了present()
, 但似乎在 SwiftUI
presentation(_ modal: Modal?)
view
不占用整个屏幕。 Navigation
也不是一个选择。
谢谢!
最佳答案
I do not want the user to have the possibility to return to the login view
// create the full screen login view
struct LoginView: View {
// ...
}
//create the full screen app veiw
struct AppView: View {
// ...
}
// create the view that swaps between them
struct StartView: View {
@EnvironmentObject var isLoggedIn: Bool // you might not want to use this specifically.
var body: some View {
isLoggedIn ? AppView() : LoginView()
}
}
@EnvironmentObject
像这样,您可以稍后对其进行编辑(退出),您的应用程序将自动返回登录屏幕。
https://stackoverflow.com/questions/56557979/
相关文章:
amazon-web-services - 提供的证书不是有效的自签名证书。请提供有效的自签名证书或
docker - 使用 Dockerfile 中的 COPY 在目标目录中复制具有不同名称的文件
xpages - 适用于 Domino Designer V10 的 Openntf Domino
maven - 将 Artifact 安装到特定的远程 Maven 存储库
amazon-web-services - AWS Api Gateway作为HTTP代理正在破坏二
audio - 在网络服务器上播放 Apple 的 .caf 音频文件?