0

This was previously marked as a duplicate of another question, but what Im asking is different. Im asking how to accomplish it through an 'if' statement.

Im creating a signup page in my app and I want it to check for letter characters only. I was planning to put it through a if statement. Something like this:

var allowedCharArray = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

if usernameTextField.text.characters != (allowedCharArray Characters) && passwordTextField.text.characters != (allowedCharArray Characters) { 
//continue 
} else {
//popup error
}

The language I'm using is swift. How would I set up this 'if' statement? Is there a better way to do this?

0 Answers0