Update README.md

Updated installation snippet to swift 4
This commit is contained in:
Johannes Pfeiffer 2017-09-29 19:06:44 +02:00 committed by GitHub
parent 6cff6cac3e
commit 0debc5d7eb
1 changed files with 10 additions and 10 deletions

View File

@ -107,16 +107,16 @@ func validationSuccessful() {
// submit the form
}
func validationFailed(errors:[(Validatable ,ValidationError)]) {
// turn the fields to red
for (field, error) in errors {
if let field = field as? UITextField {
field.layer.borderColor = UIColor.redColor().CGColor
field.layer.borderWidth = 1.0
}
error.errorLabel?.text = error.errorMessage // works if you added labels
error.errorLabel?.hidden = false
}
func validationFailed(_ errors:[(Validatable ,ValidationError)]) {
// turn the fields to red
for (field, error) in errors {
if let field = field as? UITextField {
field.layer.borderColor = UIColor.red.cgColor
field.layer.borderWidth = 1.0
}
error.errorLabel?.text = error.errorMessage // works if you added labels
error.errorLabel?.isHidden = false
}
}
```