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
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.