Hey,
So I’ve been following the custom login page tutorial and I am almost done. However, I have an error and I do not know why. it’s in reference to “return nil” and says: “‘nil’ is incompatible with return type ‘String’”. Please check the code below and let me know how to rectify the issue.
Many thanks,
Yasmin.
// Check if the password is secure
let cleanedPassword = (passwordTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines))!
if Utilities.isPasswordValid(cleanedPassword) == false {
// Password isn't secure enough
return "Please make sure your password is at least 8 characters, contaisn a special character and a number."
}
return nil
}
func signUpTapped(_ sender: Any) {
//validate the fields
let error = validateFields()
if error != nil {
// There's soemthing wrong with the fields, show error message
showError("error!")
}