I'm getting this error when I try to validate password field under a SecureTextField field.
any thoughts? I did similar with an TextField for Email validation and works just fine! my issue is with the password validation "If"
HStack {
TextField("Email Address", text: $loginVM.credentials.email) { isEditing in
self.isEditing = isEditing
errorMessage = ""
////// == getting email validation boolean after losing the focus
if isEditing == false {
if validateEmail(emailAddressString: loginVM.credentials.email) == true {
errorMessage = "YES, Email is Good"
print(errorMessage)
} else {
errorMessage = "*-Oops,Something is wrong with your email !!!"
print(errorMessage)
}
}
}
} .textFieldStyle(MyTextFieldStyle(focused: $isEditing))
HStack {
SecureTextField(text: $loginVM.credentials.password)
.padding(10)
.focused($isInFocus)
.background(
RoundedRectangle(cornerRadius: 10, style: .continuous)
.stroke(isInFocus ? Color.orange : Color.gray, lineWidth: 1))
}.disableAutocorrection(true)
// Here is where I'm getting this Type '()' cannot conform to 'View'
if validatePassword(passwordString: loginVM.credentials.password) == true {
errorMessage = "YES, Password OK"
print(errorMessage)
} else {
errorMessage = "*-Oops,Something is wrong with your Password !!!"
print(errorMessage)
}