Real Time Validation
Closed this issue · 6 comments
Would be cool to see real time validation where the boxes turn green when the field has valid data.
Looks great! Nice job Jeff
That is currently supported. All you need to do is implement the textField.delegate
and validator.validateFieldByKey(key[1], delegate:self)
Sweet!
You could add this to the demo if you want. @nickchuck
@nickchuck check out the swift-validator screen cast for an example of how to use this real-time.
validateFieldByKey
method was removed here abc729a#diff-876721a966e4b01738db78808e73a098L35. Why? We cannot more validate a specif field?
I decided to move away from the idea of having keys because I realized that the UITextField or a UIView.tag is unique.
If you want to validate a specific field you can always just use any of the rules directly like this.
// You can validate your field something like this if you want to.
var isValid = EmailRule().validate(emailTextField.text)
// You can use a tag to create a more unique reference
if emailTextField.tag == UNIQ_ID {
// run your validation this way.
}