On an authentication view, there are some inputs, like password, email, etc and a sign up button which is enabled only if theses inputs are not empty.
So what I have is this function:
func canSignUpButtonBeEnabled() -> Bool {
let password = self.passwordTextField.text.stringByReplacingOccurrencesOfString(" ", withString: "")
return (!self.emailTextField.text.isEmpty && !self.passwordTextField.text.isEmpty
&& !self.firstNameTextField.text.isEmpty && !self.lastNameTextField.text.isEmpty
&& countElements(password) >= 4)
}
And after each character entered by the user, I set on the enable property of my button the result of this function.
So I was wondering if there is a cleaner solution to do it?