How to present a view full-screen in SwiftUI?

前端 未结 4 2074
长情又很酷
长情又很酷 2021-01-02 05:33

I worked to a login view, now I want to present the view after login, but I do not want the user to have the possibility to return to the login

4条回答
  •  不知归路
    2021-01-02 06:12

    Encapsulate the body in a Group to eliminate compiler errors:

    struct StartView: View {
    
    @EnvironmentObject var userAuth: UserAuth
    
    var body: some View {
        Group {
            if userAuth.isLoggedin {
                AppView()
            } else {
                LoginView()
            }
    
        }
    }
    

提交回复
热议问题