fixes for compatibility with swift 1.2
This commit is contained in:
parent
0c50381640
commit
0497bbbbe0
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue