0
struct LoginView: View {

    @State var isUserLoggedIn = false
    
    NavigationStack{
          //.....
          Button {
              Task{
                  await viewModel.doLogin(email: email, password: password)
              }
          } label: {
              Text(Constants.LOGIN)
                .foregroundColor(Constants.BACKGROUND_COLOR)
                .font(Font.custom(Constants.FREDOKA_MEDIUM, size: 25))
                .frame(maxWidth: .infinity)
          }
    }.onChange(of: isUserLoggedIn) { isUserLoggedIn in
        debugPrint(newPasswordValue)
    }
}

I am not able to understand how to write NavigationLink if a state changes, there is no push method in navigation stack as well

ocodo
  • 29,401
  • 18
  • 105
  • 117
Chup bae
  • 69
  • 1
  • 7
  • You'r sure, you want a navigation for a NavigationStack or a NavigationSplitView and not a _sheet_ for example? Also, the `doLogin()` what's it doing anyway? It seems odd when you are calling this from your view code. It should be rather somewhere in your application network code. – CouchDeveloper Aug 31 '23 at 11:58
  • Does this answer your question? [Update environment object on listRow click before navigation](https://stackoverflow.com/questions/62374453/update-environment-object-on-listrow-click-before-navigation) – lorem ipsum Aug 31 '23 at 12:01

0 Answers0