My code doesn't work, can you point out whats wrong. I am trying to validate user input in SNameInput, error label should change it's text when the input is not valid and STitle should change it's text when user is done typing in SNameInput and it is valid, thanks!
func textFieldDidChange(SNameInput: UITextField) {
let d = ""
if (SNameInput.isEqual(d)||(SNameInput.text?.characters.count)! >= 21) {
errorLabel.text = "Name has to be a t least 1 character and not longer than 20"}
else{ errorLabel.text = ""
Stitle.text = SNameInput.text}
}
self?