How do I check UITextField values for specific types of characters e.g. Letters or Number?
问题 What I want to do is set some boolean in the if statement below to true if anything other than letters, numbers, dashes and spaces is contained in the textField. Then for an email field check for a valid email. This is how I'm checking for length: if countElements(textField.text!) < 2 || countElements(textField.text) > 15 { errorLabel.text = "Name must have between 2 and 15 characters." self.signUpView.signUpButton.enabled = false } else { errorLabel.text = "" self.signUpView.signUpButton