From 62a3087d90c749b09807eb953edcd399de98e096 Mon Sep 17 00:00:00 2001 From: alejandro soto Date: Mon, 30 Mar 2015 16:31:04 -0600 Subject: [PATCH 1/7] spec updated --- Swift-Validator.podspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Swift-Validator.podspec b/Swift-Validator.podspec index 559473c..b67c956 100644 --- a/Swift-Validator.podspec +++ b/Swift-Validator.podspec @@ -10,4 +10,6 @@ Pod::Spec.new do |s| s.platform = :ios s.source = { :git => "https://github.com/jpotts18/swift-validator.git", :tag => "2.0.1" } s.source_files = "Validator/*.swift" + s.frameworks = ['Foundation', 'UIKit'] + s.requires_arc = true end From f7d47ef2de9e6eae9eb0c97815da4b1c89168413 Mon Sep 17 00:00:00 2001 From: alejandro soto Date: Mon, 30 Mar 2015 16:49:44 -0600 Subject: [PATCH 2/7] file name updated --- Swift-Validator.podspec => Swift_Validator.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename Swift-Validator.podspec => Swift_Validator.podspec (95%) diff --git a/Swift-Validator.podspec b/Swift_Validator.podspec similarity index 95% rename from Swift-Validator.podspec rename to Swift_Validator.podspec index b67c956..5e9ec24 100644 --- a/Swift-Validator.podspec +++ b/Swift_Validator.podspec @@ -1,5 +1,5 @@ Pod::Spec.new do |s| - s.name = "Swift-Validator" + s.name = "Swift_Validator" s.version = "2.0.1" s.summary = "A UITextField Validation library for Swift" s.homepage = "https://github.com/jpotts18/swift-validator" From 3600cf0d3857de16f921543ba70faf75b1f82c40 Mon Sep 17 00:00:00 2001 From: alejandro soto Date: Mon, 30 Mar 2015 17:20:41 -0600 Subject: [PATCH 3/7] pod updates --- Swift_Validator.podspec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Swift_Validator.podspec b/Swift_Validator.podspec index 5e9ec24..7c7fd6e 100644 --- a/Swift_Validator.podspec +++ b/Swift_Validator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Swift_Validator" - s.version = "2.0.1" + s.version = "2.0.2" s.summary = "A UITextField Validation library for Swift" s.homepage = "https://github.com/jpotts18/swift-validator" s.screenshots = "https://raw.githubusercontent.com/jpotts18/swift-validator/master/swift-validator-v2.gif" @@ -8,7 +8,8 @@ Pod::Spec.new do |s| s.author = { "Jeff" => "jeff.potter6@gmail.com" } s.social_media_url = "http://twitter.com/jpotts18" s.platform = :ios - s.source = { :git => "https://github.com/jpotts18/swift-validator.git", :tag => "2.0.1" } + s.ios.deployment_target = '8.0' + s.source = { :git => "https://github.com/asotog/swift-validator.git", :tag => "2.0.2" } s.source_files = "Validator/*.swift" s.frameworks = ['Foundation', 'UIKit'] s.requires_arc = true From 56bd39702c249fc71234d2d1fcb39e592f1b826a Mon Sep 17 00:00:00 2001 From: alejandro soto Date: Mon, 30 Mar 2015 20:02:46 -0600 Subject: [PATCH 4/7] public modifiers for classes, initializers, methods.. --- Validator/ConfirmRule.swift | 6 +++--- Validator/EmailRule.swift | 11 +++++------ Validator/FullNameRule.swift | 7 +++---- Validator/PasswordRule.swift | 10 +++++----- Validator/RequiredRule.swift | 8 ++++---- Validator/Rule.swift | 2 +- Validator/ValidationError.swift | 4 ++-- Validator/ValidationRule.swift | 4 ++-- Validator/Validator.swift | 6 +++--- Validator/ZipCodeRule.swift | 6 +++--- 10 files changed, 31 insertions(+), 33 deletions(-) diff --git a/Validator/ConfirmRule.swift b/Validator/ConfirmRule.swift index e51d259..61d27b9 100644 --- a/Validator/ConfirmRule.swift +++ b/Validator/ConfirmRule.swift @@ -9,7 +9,7 @@ import Foundation import UIKit -class ConfirmationRule: Rule { +public class ConfirmationRule: Rule { let confirmField: UITextField @@ -17,7 +17,7 @@ class ConfirmationRule: Rule { self.confirmField = confirmField } - func validate(value: String) -> Bool { + public func validate(value: String) -> Bool { if self.confirmField.text == value { return true } else { @@ -25,7 +25,7 @@ class ConfirmationRule: Rule { } } - func errorMessage() -> String { + public func errorMessage() -> String { return "This field does not match" } diff --git a/Validator/EmailRule.swift b/Validator/EmailRule.swift index 4203a2a..908d006 100644 --- a/Validator/EmailRule.swift +++ b/Validator/EmailRule.swift @@ -8,19 +8,19 @@ import Foundation -class EmailRule: Rule { +public class EmailRule: Rule { var REGEX : String - init(){ + public init(){ self.REGEX = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}" } - init(regex:String){ + public init(regex:String){ REGEX = regex } - func validate(value: String) -> Bool { + public func validate(value: String) -> Bool { if let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX) { if test.evaluateWithObject(value) { return true @@ -28,8 +28,7 @@ class EmailRule: Rule { } return false } - - func errorMessage() -> String { + public func errorMessage() -> String { return "Must be a valid email address" } } \ No newline at end of file diff --git a/Validator/FullNameRule.swift b/Validator/FullNameRule.swift index af9ea87..a29423d 100644 --- a/Validator/FullNameRule.swift +++ b/Validator/FullNameRule.swift @@ -9,13 +9,13 @@ import Foundation -class FullNameRule : Rule { +public class FullNameRule : Rule { var message:String { return "Please provide a first & last name" } - func validate(value:String) -> Bool { + public func validate(value:String) -> Bool { var nameArray:[String] = split(value) { $0 == " " } if nameArray.count >= 2 { @@ -23,8 +23,7 @@ class FullNameRule : Rule { } return false } - - func errorMessage() -> String { + public func errorMessage() -> String { return message } } \ No newline at end of file diff --git a/Validator/PasswordRule.swift b/Validator/PasswordRule.swift index 5dbe149..20607b3 100644 --- a/Validator/PasswordRule.swift +++ b/Validator/PasswordRule.swift @@ -8,7 +8,7 @@ import Foundation -class PasswordRule : Rule { +public class PasswordRule : Rule { // Alternative Regexes @@ -22,15 +22,15 @@ class PasswordRule : Rule { private let REGEX: String - init(){ + public init(){ self.REGEX = "^(?=.*?[A-Z]).{8,}$" } - init(regex:String){ + public init(regex:String){ self.REGEX = regex } - func validate(value: String) -> Bool { + public func validate(value: String) -> Bool { if let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX) { if test.evaluateWithObject(value) { return true @@ -39,7 +39,7 @@ class PasswordRule : Rule { return false } - func errorMessage() -> String { + public func errorMessage() -> String { return "Must be 8 characters with 1 uppercase" } } \ No newline at end of file diff --git a/Validator/RequiredRule.swift b/Validator/RequiredRule.swift index 3075912..361a592 100644 --- a/Validator/RequiredRule.swift +++ b/Validator/RequiredRule.swift @@ -9,22 +9,22 @@ import Foundation -class RequiredRule: Rule { +public class RequiredRule: Rule { - init(){} + public init(){} var message: String { return "This field is required" } - func validate(value:String) -> Bool { + public func validate(value:String) -> Bool { if value.isEmpty { return false } return true } - func errorMessage() -> String { + public func errorMessage() -> String { return message } } \ No newline at end of file diff --git a/Validator/Rule.swift b/Validator/Rule.swift index 2d97304..caed81f 100644 --- a/Validator/Rule.swift +++ b/Validator/Rule.swift @@ -8,7 +8,7 @@ import Foundation -protocol Rule { +public protocol Rule { func validate(value:String) -> Bool func errorMessage() -> String } diff --git a/Validator/ValidationError.swift b/Validator/ValidationError.swift index ba1e20b..d882355 100644 --- a/Validator/ValidationError.swift +++ b/Validator/ValidationError.swift @@ -9,12 +9,12 @@ import Foundation import UIKit -class ValidationError { +public class ValidationError { let textField:UITextField var errorLabel:UILabel? let errorMessage:String - init(textField:UITextField, error:String){ + public init(textField:UITextField, error:String){ self.textField = textField self.errorMessage = error } diff --git a/Validator/ValidationRule.swift b/Validator/ValidationRule.swift index bd11395..e9f3ec3 100644 --- a/Validator/ValidationRule.swift +++ b/Validator/ValidationRule.swift @@ -9,12 +9,12 @@ import Foundation import UIKit -class ValidationRule { +public class ValidationRule { var textField:UITextField var errorLabel:UILabel? var rules:[Rule] = [] - init(textField: UITextField, rules:[Rule], errorLabel:UILabel?){ + public init(textField: UITextField, rules:[Rule], errorLabel:UILabel?){ self.textField = textField self.errorLabel = errorLabel self.rules = rules diff --git a/Validator/Validator.swift b/Validator/Validator.swift index 753dd3f..f55f553 100644 --- a/Validator/Validator.swift +++ b/Validator/Validator.swift @@ -9,17 +9,17 @@ import Foundation import UIKit -@objc protocol ValidationDelegate { +@objc public protocol ValidationDelegate { func validationWasSuccessful() func validationFailed(errors:[UITextField:ValidationError]) } -class Validator { +public class Validator { // dictionary to handle complex view hierarchies like dynamic tableview cells var errors:[UITextField:ValidationError] = [:] var validations:[UITextField:ValidationRule] = [:] - init(){} + public init(){} // MARK: Using Keys diff --git a/Validator/ZipCodeRule.swift b/Validator/ZipCodeRule.swift index 4d35c30..01f1b23 100644 --- a/Validator/ZipCodeRule.swift +++ b/Validator/ZipCodeRule.swift @@ -8,7 +8,7 @@ import Foundation -class ZipCodeRule: Rule { +public class ZipCodeRule: Rule { private let REGEX: String init(){ @@ -18,7 +18,7 @@ class ZipCodeRule: Rule { self.REGEX = regex } - func validate(value: String) -> Bool { + public func validate(value: String) -> Bool { if let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX) { if test.evaluateWithObject(value) { return true @@ -27,7 +27,7 @@ class ZipCodeRule: Rule { return false } - func errorMessage() -> String { + public func errorMessage() -> String { return "Enter a valid 5 digit zipcode" } From 8dafa0f02f3d1dc1fd605af1fa6b37f6197295b7 Mon Sep 17 00:00:00 2001 From: alejandro soto Date: Mon, 30 Mar 2015 20:13:06 -0600 Subject: [PATCH 5/7] more public access modifiers --- Swift_Validator.podspec | 4 ++-- Validator/Validator.swift | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Swift_Validator.podspec b/Swift_Validator.podspec index 7c7fd6e..ccf7674 100644 --- a/Swift_Validator.podspec +++ b/Swift_Validator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Swift_Validator" - s.version = "2.0.2" + s.version = "2.0.3" s.summary = "A UITextField Validation library for Swift" s.homepage = "https://github.com/jpotts18/swift-validator" s.screenshots = "https://raw.githubusercontent.com/jpotts18/swift-validator/master/swift-validator-v2.gif" @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.social_media_url = "http://twitter.com/jpotts18" s.platform = :ios s.ios.deployment_target = '8.0' - s.source = { :git => "https://github.com/asotog/swift-validator.git", :tag => "2.0.2" } + s.source = { :git => "https://github.com/asotog/swift-validator.git", :tag => "2.0.3" } s.source_files = "Validator/*.swift" s.frameworks = ['Foundation', 'UIKit'] s.requires_arc = true diff --git a/Validator/Validator.swift b/Validator/Validator.swift index f55f553..0a703e7 100644 --- a/Validator/Validator.swift +++ b/Validator/Validator.swift @@ -16,22 +16,22 @@ import UIKit public class Validator { // dictionary to handle complex view hierarchies like dynamic tableview cells - var errors:[UITextField:ValidationError] = [:] + public var errors:[UITextField:ValidationError] = [:] var validations:[UITextField:ValidationRule] = [:] public init(){} // MARK: Using Keys - func registerField(textField:UITextField, rules:[Rule]) { + public func registerField(textField:UITextField, rules:[Rule]) { validations[textField] = ValidationRule(textField: textField, rules: rules, errorLabel: nil) } - func registerField(textField:UITextField, errorLabel:UILabel, rules:[Rule]) { + public func registerField(textField:UITextField, errorLabel:UILabel, rules:[Rule]) { validations[textField] = ValidationRule(textField: textField, rules:rules, errorLabel:errorLabel) } - func validateAll(delegate:ValidationDelegate) { + public func validateAll(delegate:ValidationDelegate) { for field in validations.keys { if let currentRule:ValidationRule = validations[field] { From e10bdb3064dc4294da0285019c722372a2fff686 Mon Sep 17 00:00:00 2001 From: alejandro soto Date: Mon, 30 Mar 2015 20:14:01 -0600 Subject: [PATCH 6/7] podspec updated --- Swift_Validator.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Swift_Validator.podspec b/Swift_Validator.podspec index ccf7674..676b01d 100644 --- a/Swift_Validator.podspec +++ b/Swift_Validator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Swift_Validator" - s.version = "2.0.3" + s.version = "2.0.4" s.summary = "A UITextField Validation library for Swift" s.homepage = "https://github.com/jpotts18/swift-validator" s.screenshots = "https://raw.githubusercontent.com/jpotts18/swift-validator/master/swift-validator-v2.gif" @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.social_media_url = "http://twitter.com/jpotts18" s.platform = :ios s.ios.deployment_target = '8.0' - s.source = { :git => "https://github.com/asotog/swift-validator.git", :tag => "2.0.3" } + s.source = { :git => "https://github.com/asotog/swift-validator.git", :tag => "2.0.4" } s.source_files = "Validator/*.swift" s.frameworks = ['Foundation', 'UIKit'] s.requires_arc = true From b216f7b41192884193ec6eb4927b60ea0a93092b Mon Sep 17 00:00:00 2001 From: alejandro soto Date: Mon, 30 Mar 2015 20:54:26 -0600 Subject: [PATCH 7/7] podspec updated and more updates --- Swift_Validator.podspec | 4 ++-- Validator/ValidationError.swift | 6 +++--- Validator/ValidationRule.swift | 8 ++++---- Validator/Validator.swift | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Swift_Validator.podspec b/Swift_Validator.podspec index 676b01d..91cf930 100644 --- a/Swift_Validator.podspec +++ b/Swift_Validator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Swift_Validator" - s.version = "2.0.4" + s.version = "2.0.5" s.summary = "A UITextField Validation library for Swift" s.homepage = "https://github.com/jpotts18/swift-validator" s.screenshots = "https://raw.githubusercontent.com/jpotts18/swift-validator/master/swift-validator-v2.gif" @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.social_media_url = "http://twitter.com/jpotts18" s.platform = :ios s.ios.deployment_target = '8.0' - s.source = { :git => "https://github.com/asotog/swift-validator.git", :tag => "2.0.4" } + s.source = { :git => "https://github.com/asotog/swift-validator.git", :tag => "2.0.5" } s.source_files = "Validator/*.swift" s.frameworks = ['Foundation', 'UIKit'] s.requires_arc = true diff --git a/Validator/ValidationError.swift b/Validator/ValidationError.swift index d882355..49fbace 100644 --- a/Validator/ValidationError.swift +++ b/Validator/ValidationError.swift @@ -10,9 +10,9 @@ import Foundation import UIKit public class ValidationError { - let textField:UITextField - var errorLabel:UILabel? - let errorMessage:String + public let textField:UITextField + public var errorLabel:UILabel? + public let errorMessage:String public init(textField:UITextField, error:String){ self.textField = textField diff --git a/Validator/ValidationRule.swift b/Validator/ValidationRule.swift index e9f3ec3..48b3279 100644 --- a/Validator/ValidationRule.swift +++ b/Validator/ValidationRule.swift @@ -10,9 +10,9 @@ import Foundation import UIKit public class ValidationRule { - var textField:UITextField - var errorLabel:UILabel? - var rules:[Rule] = [] + public var textField:UITextField + public var errorLabel:UILabel? + public var rules:[Rule] = [] public init(textField: UITextField, rules:[Rule], errorLabel:UILabel?){ self.textField = textField @@ -20,7 +20,7 @@ public class ValidationRule { self.rules = rules } - func validateField() -> ValidationError? { + public func validateField() -> ValidationError? { for rule in rules { var isValid:Bool = rule.validate(textField.text) if !isValid { diff --git a/Validator/Validator.swift b/Validator/Validator.swift index 0a703e7..181b978 100644 --- a/Validator/Validator.swift +++ b/Validator/Validator.swift @@ -17,7 +17,7 @@ import UIKit public class Validator { // dictionary to handle complex view hierarchies like dynamic tableview cells public var errors:[UITextField:ValidationError] = [:] - var validations:[UITextField:ValidationRule] = [:] + public var validations:[UITextField:ValidationRule] = [:] public init(){}