Skip to content

Commit 5c22740

Browse files
committed
Merge pull request #10 from asotog/master
Cocoapods and swift 1.1 support
2 parents 07cc072 + 28180d8 commit 5c22740

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Pod::Spec.new do |s|
88
s.author = { "Jeff" => "jeff.potter6@gmail.com" }
99
s.social_media_url = "http://twitter.com/jpotts18"
1010
s.platform = :ios
11-
s.ios.deployment_target = '8.0'
1211
s.source = { :git => "https://github.com/jpotts18/swift-validator.git", :tag => "2.0.1" }
1312
s.source_files = "Validator/*.swift"
1413
end

Validator/EmailRule.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ class EmailRule: Rule {
2121
}
2222

2323
func validate(value: String) -> Bool {
24-
let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX)
25-
if test.evaluateWithObject(value) {
26-
return true
24+
if let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX) {
25+
if test.evaluateWithObject(value) {
26+
return true
27+
}
2728
}
2829
return false
2930
}

Validator/MinLengthRule.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MinLengthRule : Rule {
2222
}
2323

2424
func validate(value: String) -> Bool {
25-
if count(value) < DEFAULT_MIN_LENGTH {
25+
if countElements(value) < DEFAULT_MIN_LENGTH {
2626
return false
2727
}
2828
return true

Validator/PasswordRule.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ class PasswordRule : Rule {
3131
}
3232

3333
func validate(value: String) -> Bool {
34-
let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX)
35-
if test.evaluateWithObject(value) {
36-
return true
34+
if let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX) {
35+
if test.evaluateWithObject(value) {
36+
return true
37+
}
3738
}
3839
return false
3940
}

Validator/ZipCodeRule.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ class ZipCodeRule: Rule {
1919
}
2020

2121
func validate(value: String) -> Bool {
22-
let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX)
23-
if test.evaluateWithObject(value) {
24-
return true
22+
if let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX) {
23+
if test.evaluateWithObject(value) {
24+
return true
25+
}
2526
}
2627
return false
2728
}

0 commit comments

Comments
 (0)