Skip to content

Commit b89c188

Browse files
UITextField.text is now an optional
With the Xcode 7 GM release `text` is now an optional despite the documentation stating a default value of "" so we need to unwrap it or provide a default to satisfy the compiler.
1 parent 9b34d13 commit b89c188

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Validator/ValidationRule.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class ValidationRule {
2121
}
2222

2323
public func validateField() -> ValidationError? {
24-
return rules.filter{ !$0.validate(self.textField.text) }
24+
return rules.filter{ !$0.validate(self.textField.text ?? "") }
2525
.map{ rule -> ValidationError in return ValidationError(textField: self.textField, errorLabel:self.errorLabel, error: rule.errorMessage()) }.first
2626
}
2727
}

0 commit comments

Comments
 (0)