File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public class MaxLengthRule: Rule {
1818 }
1919
2020 public func validate( value: String ) -> Bool {
21- return countElements ( value) <= DEFAULT_LENGTH
21+ return count ( value) <= DEFAULT_LENGTH
2222 }
2323
2424 public func errorMessage( ) -> String {
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public class MinLengthRule: Rule {
1919 }
2020
2121 public func validate( value: String ) -> Bool {
22- return countElements ( value) >= DEFAULT_LENGTH
22+ return count ( value) >= DEFAULT_LENGTH
2323 }
2424
2525 public func errorMessage( ) -> String {
Original file line number Diff line number Diff line change @@ -17,13 +17,8 @@ class PhoneNumberRule: Rule {
1717 }
1818
1919 func validate( value: String ) -> Bool {
20- if let phoneTest = NSPredicate ( format: " SELF MATCHES %@ " , PHONE_REGEX) {
21- if phoneTest. evaluateWithObject ( value) {
22- return true
23- }
24- return false
25- }
26- return false
20+ var phoneTest = NSPredicate ( format: " SELF MATCHES %@ " , PHONE_REGEX)
21+ return phoneTest. evaluateWithObject ( value)
2722 }
2823
2924 func errorMessage( ) -> String {
Original file line number Diff line number Diff line change @@ -17,12 +17,8 @@ public class RegexRule : Rule {
1717 }
1818
1919 public func validate( value: String ) -> Bool {
20- if let test = NSPredicate ( format: " SELF MATCHES %@ " , self . REGEX) {
21- if test. evaluateWithObject ( value) {
22- return true
23- }
24- }
25- return false
20+ let test = NSPredicate ( format: " SELF MATCHES %@ " , self . REGEX)
21+ return test. evaluateWithObject ( value)
2622 }
2723
2824 public func errorMessage( ) -> String {
You can’t perform that action at this time.
0 commit comments