diff --git a/Validator/MaxLengthRule.swift b/Validator/MaxLengthRule.swift index b9bcee5..f6b346a 100644 --- a/Validator/MaxLengthRule.swift +++ b/Validator/MaxLengthRule.swift @@ -18,7 +18,7 @@ public class MaxLengthRule: Rule { } public func validate(value: String) -> Bool { - return countElements(value) <= DEFAULT_LENGTH + return count(value) <= DEFAULT_LENGTH } public func errorMessage() -> String { diff --git a/Validator/MinLengthRule.swift b/Validator/MinLengthRule.swift index 952e0ce..c5cf308 100644 --- a/Validator/MinLengthRule.swift +++ b/Validator/MinLengthRule.swift @@ -19,7 +19,7 @@ public class MinLengthRule: Rule { } public func validate(value: String) -> Bool { - return countElements(value) >= DEFAULT_LENGTH + return count(value) >= DEFAULT_LENGTH } public func errorMessage() -> String { diff --git a/Validator/PhoneNumberRule.swift b/Validator/PhoneNumberRule.swift index 65cd113..10b555a 100644 --- a/Validator/PhoneNumberRule.swift +++ b/Validator/PhoneNumberRule.swift @@ -17,13 +17,8 @@ class PhoneNumberRule: Rule { } func validate(value: String) -> Bool { - if let phoneTest = NSPredicate(format: "SELF MATCHES %@", PHONE_REGEX) { - if phoneTest.evaluateWithObject(value) { - return true - } - return false - } - return false + var phoneTest = NSPredicate(format: "SELF MATCHES %@", PHONE_REGEX) + return phoneTest.evaluateWithObject(value) } func errorMessage() -> String { diff --git a/Validator/RegexRule.swift b/Validator/RegexRule.swift index 2f10190..af00238 100644 --- a/Validator/RegexRule.swift +++ b/Validator/RegexRule.swift @@ -17,12 +17,8 @@ public class RegexRule : Rule { } public func validate(value: String) -> Bool { - if let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX) { - if test.evaluateWithObject(value) { - return true - } - } - return false + let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX) + return test.evaluateWithObject(value) } public func errorMessage() -> String {