I have a conditional statement to show a @State to the user either to sign in or sign up. When I click on the SignIn$SignUpButton, the @State of the button change but my conditional statement doesn't trigger.
Is there anything missing?
struct CredentialsView: View {
@State var signInSelected = true
@State var signUpSelected = false
@State var firstName = ""
@State var email = ""
@State var password = ""
@State var confirmPassword = ""
var body: some View {
VStack {
SignIn$SingUpButton(signInSelected: signInSelected,
signUpSelected: signUpSelected
)
VStack(spacing: 30) {
if signInSelected {
UserEntryTextField(title: "email", userEntry: email)
UserEntryTextField(title: "password", userEntry: password)
}
else if signUpSelected {
UserEntryTextField(title: "first name", userEntry: firstName)
UserEntryTextField(title: "email", userEntry: email)
UserEntryTextField(title: "password", userEntry: password)
UserEntryTextField(title: "confirm Password", userEntry: confirmPassword)
}
}
.padding(.top, signInSelected ? 110 : 50)
Spacer()
}
.padding(.vertical, 40)
}
}
Aucun commentaire:
Enregistrer un commentaire