diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..8d81f08 Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore deleted file mode 100644 index f196f1a..0000000 --- a/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -.DS_Store -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate - -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control -# -Pods/ - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -Carthage/Checkouts - -Carthage/Build diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 46ffccd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: objective-c -osx_image: xcode10.1 -xcode_sdk: iphonesimulator10.0 -xcode_project: Validator.xcodeproj -xcode_scheme: Validator - -before_install: - - gem install cocoapods -v '0.32.1' - - gem install xcpretty --no-rdoc --no-ri --no-document --quiet - -script: - - xcodebuild clean build test -project Validator.xcodeproj -scheme Validator -sdk iphonesimulator -destination "platform=iOS Simulator,OS=10.0,name=iPhone 6" -enableCodeCoverage YES CODE_SIGNING_REQUIRED=NO | xcpretty - - pod lib lint -after_success: - - - bash <(curl -s https://codecov.io/bash) - - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/4cfa929bd227586305cc - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always diff --git a/docs/Classes.html b/Classes.html similarity index 100% rename from docs/Classes.html rename to Classes.html diff --git a/docs/Classes/AlphaNumericRule.html b/Classes/AlphaNumericRule.html similarity index 100% rename from docs/Classes/AlphaNumericRule.html rename to Classes/AlphaNumericRule.html diff --git a/docs/Classes/AlphaRule.html b/Classes/AlphaRule.html similarity index 100% rename from docs/Classes/AlphaRule.html rename to Classes/AlphaRule.html diff --git a/docs/Classes/CharacterSetRule.html b/Classes/CharacterSetRule.html similarity index 100% rename from docs/Classes/CharacterSetRule.html rename to Classes/CharacterSetRule.html diff --git a/docs/Classes/ConfirmationRule.html b/Classes/ConfirmationRule.html similarity index 100% rename from docs/Classes/ConfirmationRule.html rename to Classes/ConfirmationRule.html diff --git a/docs/Classes/EmailRule.html b/Classes/EmailRule.html similarity index 100% rename from docs/Classes/EmailRule.html rename to Classes/EmailRule.html diff --git a/docs/Classes/ExactLengthRule.html b/Classes/ExactLengthRule.html similarity index 100% rename from docs/Classes/ExactLengthRule.html rename to Classes/ExactLengthRule.html diff --git a/docs/Classes/FloatRule.html b/Classes/FloatRule.html similarity index 100% rename from docs/Classes/FloatRule.html rename to Classes/FloatRule.html diff --git a/docs/Classes/FullNameRule.html b/Classes/FullNameRule.html similarity index 100% rename from docs/Classes/FullNameRule.html rename to Classes/FullNameRule.html diff --git a/docs/Classes/HexColorRule.html b/Classes/HexColorRule.html similarity index 100% rename from docs/Classes/HexColorRule.html rename to Classes/HexColorRule.html diff --git a/docs/Classes/IPV4Rule.html b/Classes/IPV4Rule.html similarity index 100% rename from docs/Classes/IPV4Rule.html rename to Classes/IPV4Rule.html diff --git a/docs/Classes/ISBNRule.html b/Classes/ISBNRule.html similarity index 100% rename from docs/Classes/ISBNRule.html rename to Classes/ISBNRule.html diff --git a/docs/Classes/MaxLengthRule.html b/Classes/MaxLengthRule.html similarity index 100% rename from docs/Classes/MaxLengthRule.html rename to Classes/MaxLengthRule.html diff --git a/docs/Classes/MinLengthRule.html b/Classes/MinLengthRule.html similarity index 100% rename from docs/Classes/MinLengthRule.html rename to Classes/MinLengthRule.html diff --git a/docs/Classes/PasswordRule.html b/Classes/PasswordRule.html similarity index 100% rename from docs/Classes/PasswordRule.html rename to Classes/PasswordRule.html diff --git a/docs/Classes/PhoneNumberRule.html b/Classes/PhoneNumberRule.html similarity index 100% rename from docs/Classes/PhoneNumberRule.html rename to Classes/PhoneNumberRule.html diff --git a/docs/Classes/RegexRule.html b/Classes/RegexRule.html similarity index 100% rename from docs/Classes/RegexRule.html rename to Classes/RegexRule.html diff --git a/docs/Classes/RequiredRule.html b/Classes/RequiredRule.html similarity index 100% rename from docs/Classes/RequiredRule.html rename to Classes/RequiredRule.html diff --git a/docs/Classes/ValidationError.html b/Classes/ValidationError.html similarity index 100% rename from docs/Classes/ValidationError.html rename to Classes/ValidationError.html diff --git a/docs/Classes/ValidationRule.html b/Classes/ValidationRule.html similarity index 100% rename from docs/Classes/ValidationRule.html rename to Classes/ValidationRule.html diff --git a/docs/Classes/Validator.html b/Classes/Validator.html similarity index 100% rename from docs/Classes/Validator.html rename to Classes/Validator.html diff --git a/docs/Classes/ZipCodeRule.html b/Classes/ZipCodeRule.html similarity index 100% rename from docs/Classes/ZipCodeRule.html rename to Classes/ZipCodeRule.html diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 6d980d2..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2014-2015 Jeff Potter - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/docs/Protocols.html b/Protocols.html similarity index 100% rename from docs/Protocols.html rename to Protocols.html diff --git a/docs/Protocols/Rule.html b/Protocols/Rule.html similarity index 100% rename from docs/Protocols/Rule.html rename to Protocols/Rule.html diff --git a/docs/Protocols/ValidationDelegate.html b/Protocols/ValidationDelegate.html similarity index 100% rename from docs/Protocols/ValidationDelegate.html rename to Protocols/ValidationDelegate.html diff --git a/README.md b/README.md deleted file mode 100644 index 79e3c7b..0000000 --- a/README.md +++ /dev/null @@ -1,181 +0,0 @@ -SwiftValidator -=============== - -[![Build Status](https://travis-ci.org/SwiftValidatorCommunity/SwiftValidator.svg?branch=master)](https://travis-ci.org/SwiftValidatorCommunity/SwiftValidator) [![codecov.io](https://codecov.io/github/SwiftValidatorCommunity/SwiftValidator/coverage.svg?branch=master)](https://codecov.io/github/SwiftValidatorCommunity/SwiftValidator?branch=master) - -Swift Validator is a rule-based validation library for Swift. - -![Swift Validator](/swift-validator-v2.gif) - -## Core Concepts - -* ``UITextField`` + ``[Rule]`` + (and optional error ``UILabel``) go into ``Validator`` -* ``UITextField`` + ``ValidationError`` come out of ``Validator`` -* ``Validator`` evaluates ``[Rule]`` sequentially and stops evaluating when a ``Rule`` fails. - -## Installation - -```ruby -# Podfile -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, "8.1" - -use_frameworks! - -# Swift 4.2 -pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :tag => '4.2.0' - -# Swift 3 -# Extended beyond UITextField -pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :branch => 'master' - -# Swift 2.1 -# Extended beyond UITextField -# Note: Installing 4.x.x will break code from 3.x.x -pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :tag => '4.0.0' - -# Swift 2.1 (limited to UITextField validation) -pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :tag => '3.0.5' -``` - -Install into your project: - -```bash -$ pod install -``` - -Open your project in Xcode from the .xcworkspace file (not the usual project file): - -```bash -$ open MyProject.xcworkspace -``` - -If you are using Carthage you will need to add this to your `Cartfile` - -```bash -github "jpotts18/SwiftValidator" -``` - -## Usage - -You can now import SwiftValidator framework into your files. - -Initialize the ``Validator`` by setting a delegate to a View Controller or other object. - -```swift -// ViewController.swift -let validator = Validator() -``` - -Register the fields that you want to validate - -```swift -override func viewDidLoad() { - super.viewDidLoad() - - // Validation Rules are evaluated from left to right. - validator.registerField(fullNameTextField, rules: [RequiredRule(), FullNameRule()]) - - // You can pass in error labels with your rules - // You can pass in custom error messages to regex rules (such as ZipCodeRule and EmailRule) - validator.registerField(emailTextField, errorLabel: emailErrorLabel, rules: [RequiredRule(), EmailRule(message: "Invalid email")]) - - // You can validate against other fields using ConfirmRule - validator.registerField(emailConfirmTextField, errorLabel: emailConfirmErrorLabel, rules: [ConfirmationRule(confirmField: emailTextField)]) - - // You can now pass in regex and length parameters through overloaded contructors - validator.registerField(phoneNumberTextField, errorLabel: phoneNumberErrorLabel, rules: [RequiredRule(), MinLengthRule(length: 9)]) - validator.registerField(zipcodeTextField, errorLabel: zipcodeErrorLabel, rules: [RequiredRule(), ZipCodeRule(regex : "\\d{5}")]) - - // You can unregister a text field if you no longer want to validate it - validator.unregisterField(fullNameTextField) -} -``` - - -Validate Fields on button tap or however you would like to trigger it. - -```swift -@IBAction func signupTapped(sender: AnyObject) { - validator.validate(self) -} -``` - -Implement the Validation Delegate in your View controller - -```swift -// ValidationDelegate methods - -func validationSuccessful() { - // submit the form -} - -func validationFailed(_ errors:[(Validatable ,ValidationError)]) { - // turn the fields to red - for (field, error) in errors { - if let field = field as? UITextField { - field.layer.borderColor = UIColor.red.cgColor - field.layer.borderWidth = 1.0 - } - error.errorLabel?.text = error.errorMessage // works if you added labels - error.errorLabel?.isHidden = false - } -} - -``` - -## Single Field Validation - -You may use single field validation in some cases. This could be useful in situations such as controlling responders: - -```swift -// Don't forget to use UITextFieldDelegate -// and delegate yourTextField to self in viewDidLoad() -func textFieldShouldReturn(textField: UITextField) -> Bool { - validator.validateField(textField){ error in - if error == nil { - // Field validation was successful - } else { - // Validation error occurred - } - } - return true -} -``` - -## Custom Validation - -We will create a ```SSNRule``` class to show how to create your own Validation. A United States Social Security Number (or SSN) is a field that consists of XXX-XX-XXXX. - -Create a class that inherits from RegexRule - -```swift - -class SSNVRule: RegexRule { - - static let regex = "^\\d{3}-\\d{2}-\\d{4}$" - - convenience init(message : String = "Not a valid SSN"){ - self.init(regex: SSNVRule.regex, message : message) - } -} -``` - -## Documentation -Checkout the docs here via [@jazzydocs](https://twitter.com/jazzydocs). - - -Credits -------- - -Swift Validator is written and maintained by Jeff Potter [@jpotts18](http://twitter.com/jpotts18). David Patterson [@dave_tw12](http://twitter.com/dave_tw12) actively works as a collaborator. Special thanks to [Deniz Adalar](https://github.com/dadalar) for -adding validation beyond UITextField. - -## Contributing - -1. [Fork it](https://github.com/jpotts18/SwiftValidator/fork) -2. Create your feature branch `git checkout -b my-new-feature` -3. Commit your changes `git commit -am 'Add some feature'` -4. Push to the branch `git push origin my-new-feature` -5. Create a new Pull Request -6. Make sure code coverage is at least 70% diff --git a/SwiftValidator.podspec b/SwiftValidator.podspec deleted file mode 100644 index e426329..0000000 --- a/SwiftValidator.podspec +++ /dev/null @@ -1,18 +0,0 @@ -Pod::Spec.new do |s| - s.name = "SwiftValidator" - s.version = "4.0.0" - s.swift_version = "4.2" - s.summary = "A UITextField Validation library for Swift" - s.homepage = "https://github.com/jpotts18/SwiftValidator" - s.screenshots = "https://raw.githubusercontent.com/jpotts18/SwiftValidator/master/swift-validator-v2.gif" - s.license = { :type => "MIT", :file => "LICENSE.txt" } - s.author = { "Jeff Potter" => "jeff.potter6@gmail.com" } - s.social_media_url = "http://twitter.com/jpotts18" - s.platform = :ios - s.ios.deployment_target = '8.0' - s.source = { :git => "https://github.com/jpotts18/SwiftValidator.git", :tag => "4.0.0" } - s.source_files = "SwiftValidator/**/*.swift" - s.exclude_files = "Validator/AppDelegate.swift" - s.frameworks = ['Foundation', 'UIKit'] - s.requires_arc = true -end diff --git a/SwiftValidator/Core/Validatable.swift b/SwiftValidator/Core/Validatable.swift deleted file mode 100644 index 4778f3a..0000000 --- a/SwiftValidator/Core/Validatable.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// Validatable.swift -// Validator -// -// Created by Deniz Adalar on 28/04/16. -// Copyright © 2016 jpotts18. All rights reserved. -// - -import Foundation - -public typealias ValidatableField = AnyObject & Validatable - -public protocol Validatable { - - var validationText: String { - get - } -} - -extension UITextField: Validatable { - - open var validationText: String { - return text ?? "" - } -} - -extension UITextView: Validatable { - - public var validationText: String { - return text ?? "" - } -} - diff --git a/SwiftValidator/Core/ValidationDelegate.swift b/SwiftValidator/Core/ValidationDelegate.swift deleted file mode 100644 index 0e073ed..0000000 --- a/SwiftValidator/Core/ValidationDelegate.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// ValidationDelegate.swift -// Validator -// -// Created by David Patterson on 1/2/16. -// Copyright © 2016 jpotts18. All rights reserved. -// - -import Foundation -import UIKit -/** - Protocol for `ValidationDelegate` adherents, which comes with two required methods that are called depending on whether validation succeeded or failed. - */ -public protocol ValidationDelegate { - /** - This method will be called on delegate object when validation is successful. - - - returns: No return value. - */ - func validationSuccessful() - /** - This method will be called on delegate object when validation fails. - - - returns: No return value. - */ - func validationFailed(_ errors: [(Validatable, ValidationError)]) -} diff --git a/SwiftValidator/Core/ValidationError.swift b/SwiftValidator/Core/ValidationError.swift deleted file mode 100644 index 98ab4de..0000000 --- a/SwiftValidator/Core/ValidationError.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// Created by Jeff Potter on 11/11/14. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation -import UIKit - -/** - The `ValidationError` class is used for representing errors of a failed validation. It contains the field, error label, and error message of a failed validation. - */ -public class ValidationError: NSObject { - /// the Validatable field of the field - public let field:ValidatableField - /// the error label of the field - public var errorLabel:UILabel? - /// the error message of the field - public let errorMessage:String - - /** - Initializes `ValidationError` object with a field, errorLabel, and errorMessage. - - - parameter field: Validatable field that holds field. - - parameter errorLabel: UILabel that holds error label. - - parameter errorMessage: String that holds error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(field:ValidatableField, errorLabel:UILabel?, error:String){ - self.field = field - self.errorLabel = errorLabel - self.errorMessage = error - } -} \ No newline at end of file diff --git a/SwiftValidator/Core/Validator.swift b/SwiftValidator/Core/Validator.swift deleted file mode 100644 index 2553e47..0000000 --- a/SwiftValidator/Core/Validator.swift +++ /dev/null @@ -1,154 +0,0 @@ -// -// Validator.swift -// -// Created by Jeff Potter on 11/10/14. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation -import UIKit - -/** - Class that makes `Validator` objects. Should be added as a parameter to ViewController that will display - validation fields. - */ -public class Validator { - /// Dictionary to hold all fields (and accompanying rules) that will undergo validation. - public var validations = ValidatorDictionary() - /// Dictionary to hold fields (and accompanying errors) that were unsuccessfully validated. - public var errors = ValidatorDictionary() - /// Dictionary to hold fields by their object identifiers - private var fields = ValidatorDictionary() - /// Variable that holds success closure to display positive status of field. - private var successStyleTransform:((_ validationRule:ValidationRule)->Void)? - /// Variable that holds error closure to display negative status of field. - private var errorStyleTransform:((_ validationError:ValidationError)->Void)? - /// - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - public init(){} - - // MARK: Private functions - - /** - This method is used to validate all fields registered to Validator. If validation is unsuccessful, - field gets added to errors dictionary. - - - returns: No return value. - */ - private func validateAllFields() { - - errors = ValidatorDictionary() - - for (_, rule) in validations { - if let error = rule.validateField() { - errors[rule.field] = error - - // let the user transform the field if they want - if let transform = self.errorStyleTransform { - transform(error) - } - } else { - // No error - // let the user transform the field if they want - if let transform = self.successStyleTransform { - transform(rule) - } - } - } - } - - // MARK: Public functions - - /** - This method is used to validate a single field registered to Validator. If validation is unsuccessful, - field gets added to errors dictionary. - - - parameter field: Holds validator field data. - - returns: No return value. - */ - public func validateField(_ field: ValidatableField, callback: (_ error:ValidationError?) -> Void){ - if let fieldRule = validations[field] { - if let error = fieldRule.validateField() { - errors[field] = error - if let transform = self.errorStyleTransform { - transform(error) - } - callback(error) - } else { - if let transform = self.successStyleTransform { - transform(fieldRule) - } - callback(nil) - } - } else { - callback(nil) - } - } - - // MARK: Using Keys - - /** - This method is used to style fields that have undergone validation checks. Success callback should be used to show common success styling and error callback should be used to show common error styling. - - - parameter success: A closure which is called with validationRule, an object that holds validation data - - parameter error: A closure which is called with validationError, an object that holds validation error data - - returns: No return value - */ - public func styleTransformers(success:((_ validationRule:ValidationRule)->Void)?, error:((_ validationError:ValidationError)->Void)?) { - self.successStyleTransform = success - self.errorStyleTransform = error - } - - /** - This method is used to add a field to validator. - - - parameter field: field that is to be validated. - - parameter errorLabel: A UILabel that holds error label data - - parameter rules: A Rule array that holds different rules that apply to said field. - - returns: No return value - */ - public func registerField(_ field: ValidatableField, errorLabel:UILabel? = nil, rules:[Rule]) { - validations[field] = ValidationRule(field: field, rules:rules, errorLabel:errorLabel) - fields[field] = field - } - - /** - This method is for removing a field validator. - - - parameter field: field used to locate and remove field from validator. - - returns: No return value - */ - public func unregisterField(_ field:ValidatableField) { - validations.removeValueForKey(field) - errors.removeValueForKey(field) - } - - /** - This method checks to see if all fields in validator are valid. - - - returns: No return value. - */ - public func validate(_ delegate:ValidationDelegate) { - - self.validateAllFields() - - if errors.isEmpty { - delegate.validationSuccessful() - } else { - delegate.validationFailed(errors.map { (fields[$1.field]!, $1) }) - } - - } - - /** - This method validates all fields in validator and sets any errors to errors parameter of callback. - - - parameter callback: A closure which is called with errors, a dictionary of type Validatable:ValidationError. - - returns: No return value. - */ - public func validate(_ callback:(_ errors:[(Validatable, ValidationError)])->Void) -> Void { - - self.validateAllFields() - - callback(errors.map { (fields[$1.field]!, $1) } ) - } -} diff --git a/SwiftValidator/Core/ValidatorDictionary.swift b/SwiftValidator/Core/ValidatorDictionary.swift deleted file mode 100644 index e152b0f..0000000 --- a/SwiftValidator/Core/ValidatorDictionary.swift +++ /dev/null @@ -1,45 +0,0 @@ -// -// ValidatorDictionary.swift -// Validator -// -// Created by Deniz Adalar on 04/05/16. -// Copyright © 2016 jpotts18. All rights reserved. -// - -import Foundation - -public struct ValidatorDictionary : Sequence { - - private var innerDictionary: [ObjectIdentifier: T] = [:]; - - public subscript(key: ValidatableField?) -> T? { - get { - if let key = key { - return innerDictionary[ObjectIdentifier(key)]; - } else { - return nil; - } - } - set(newValue) { - if let key = key { - innerDictionary[ObjectIdentifier(key)] = newValue; - } - } - } - - public mutating func removeAll() { - innerDictionary.removeAll() - } - - public mutating func removeValueForKey(_ key: ValidatableField) { - innerDictionary.removeValue(forKey: ObjectIdentifier(key)) - } - - public var isEmpty: Bool { - return innerDictionary.isEmpty - } - - public func makeIterator() -> DictionaryIterator { - return innerDictionary.makeIterator() - } -} diff --git a/SwiftValidator/Info.plist b/SwiftValidator/Info.plist deleted file mode 100644 index d3de8ee..0000000 --- a/SwiftValidator/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/SwiftValidator/Rules/AlphaNumericRule.swift b/SwiftValidator/Rules/AlphaNumericRule.swift deleted file mode 100644 index ba8f017..0000000 --- a/SwiftValidator/Rules/AlphaNumericRule.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// AlphaNumericRule.swift -// Validator -// -// Created by Bhargav Gurlanka on 2/4/16. -// Copyright © 2016 jpotts18. All rights reserved. -// - -import Foundation - -/** - `AlphaNumericRule` is a subclass of `CharacterSetRule`. It is used to verify that a field has a - valid list of alphanumeric characters. - */ -public class AlphaNumericRule: CharacterSetRule { - - /** - Initializes a `AlphaNumericRule` object to verify that field has valid set of alphanumeric characters. - - - parameter message: String of error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(message: String = "Enter valid numeric characters") { - super.init(characterSet: CharacterSet.alphanumerics, message: message) - } -} diff --git a/SwiftValidator/Rules/AlphaRule.swift b/SwiftValidator/Rules/AlphaRule.swift deleted file mode 100644 index 3e9c4cd..0000000 --- a/SwiftValidator/Rules/AlphaRule.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// AlphaRule.swift -// Validator -// -// Created by Bhargav Gurlanka on 2/4/16. -// Copyright © 2016 jpotts18. All rights reserved. -// - -import Foundation - -/** - `AlphaRule` is a subclass of `CharacterSetRule`. It is used to verify that a field has a - valid list of alpha characters. - */ -public class AlphaRule: CharacterSetRule { - - /** - Initializes an `AlphaRule` object to verify that a field has valid set of alpha characters. - - - parameter message: String of error message. - - returns: An initialized object, or nil if an object could not be created for some reason. - */ - public init(message: String = "Enter valid alphabetic characters") { - super.init(characterSet: CharacterSet.letters, message: message) - } -} diff --git a/SwiftValidator/Rules/CardExpiryMonthRule.swift b/SwiftValidator/Rules/CardExpiryMonthRule.swift deleted file mode 100644 index 3091544..0000000 --- a/SwiftValidator/Rules/CardExpiryMonthRule.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// CardExpiryMonthRule.swift -// Validator -// -// Created by Ifeanyi Ndu on 15/01/2017. -// Copyright © 2017 jpotts18. All rights reserved. -// - -import Foundation - -/** - `CardExpiryMonthRule` is a subclass of `Rule` that defines how a credit/debit's card expiry month field is validated - */ -public class CardExpiryMonthRule: Rule { - /// Error message to be displayed if validation fails. - private var message: String = "Must be a valid calendar month" - /** - Initializes `CardExpiryMonthRule` object with error message. Used to validate a card's expiry month. - - - parameter message: String of error message. - - returns: An initialized `CardExpiryMonthRule` object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(message : String = "Must be a valid calendar month"){ - self.message = message - } - - /** - Validates a field. - - - parameter value: String to check for validation. - - returns: Boolean value. True on successful validation, otherwise False on failed Validation. - */ - public func validate(_ value: String) -> Bool { - - guard let month = Int(value) else { - return false - } - return month >= 1 && month <= 12 - } - - /** - Used to display error message when validation fails. - - - returns: String of error message. - */ - public func errorMessage() -> String { - return message - } - -} diff --git a/SwiftValidator/Rules/CardExpiryYearRule.swift b/SwiftValidator/Rules/CardExpiryYearRule.swift deleted file mode 100644 index c02eab7..0000000 --- a/SwiftValidator/Rules/CardExpiryYearRule.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// CardExpiryYearRule.swift -// Validator -// -// Created by Ifeanyi Ndu on 15/01/2017. -// Copyright © 2017 jpotts18. All rights reserved. -// - -import Foundation - -/** - `CardExpiryYearRule` is a subclass of `Rule` that defines how a credit/debit's card expiry year field is validated - */ -public class CardExpiryYearRule: Rule { - /// Error message to be displayed if validation fails. - private var message: String = "Must be within 3 years of validity" - ///Default maximum validity period. Change to preferred value - private var MAX_VALIDITY: Int = 3 - - /** - Initializes `CardExpiryYearRule` object with error message. Used to validate a card's expiry year. - - - parameter message: String of error message. - - returns: An initialized `CardExpiryYearRule` object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(message : String = "Must be within 3 years of validity"){ - - self.message = message - - } - - /** - Validates a field. - - - parameter value: String to check for validation. - - returns: Boolean value. True on successful validation, otherwise False on failed Validation. - */ - public func validate(_ value: String) -> Bool { - - ///Holds the current year - let thisYear = NSCalendar.current.component(Calendar.Component.year, from: Date()) - - guard let year = Int(value) else { - return false - } - - return year >= thisYear && year <= (thisYear + MAX_VALIDITY) - } - - /** - Used to display error message when validation fails. - - - returns: String of error message. - */ - public func errorMessage() -> String { - return message - } - -} diff --git a/SwiftValidator/Rules/CharacterSetRule.swift b/SwiftValidator/Rules/CharacterSetRule.swift deleted file mode 100644 index d897132..0000000 --- a/SwiftValidator/Rules/CharacterSetRule.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// CharacterSetRule.swift -// Validator -// -// Created by Bhargav Gurlanka on 2/4/16. -// Copyright © 2016 jpotts18. All rights reserved. -// - -import Foundation - -/** - `CharacterSetRule` is a subclass of `Rule`. It is used to validate IPV4 address fields. - */ -public class CharacterSetRule: Rule { - /// NSCharacter that hold set of valid characters to hold - private let characterSet: CharacterSet - /// String that holds error message - private var message: String - - /** - Initializes a `CharacterSetRule` object to verify that field has valid set of characters. - - - parameter characterSet: NSCharacterSet that holds group of valid characters. - - parameter message: String of error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(characterSet: CharacterSet, message: String = "Enter valid alpha") { - self.characterSet = characterSet - self.message = message - } - - /** - Used to validate field. - - - parameter value: String to checked for validation. - - returns: Boolean value. True if validation is successful; False if validation fails. - */ - public func validate(_ value: String) -> Bool { - for uni in value.unicodeScalars { - guard let uniVal = UnicodeScalar(uni.value), characterSet.contains(uniVal) else { - return false - } - } - return true - } - - /** - Displays error message when field fails validation. - - - returns: String of error message. - */ - public func errorMessage() -> String { - return message - } -} diff --git a/SwiftValidator/Rules/ConfirmRule.swift b/SwiftValidator/Rules/ConfirmRule.swift deleted file mode 100644 index 52f136d..0000000 --- a/SwiftValidator/Rules/ConfirmRule.swift +++ /dev/null @@ -1,52 +0,0 @@ -// -// ConfirmRule.swift -// Validator -// -// Created by Jeff Potter on 3/6/15. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation -import UIKit - -/** - `ConfirmationRule` is a subclass of Rule that defines how a field that has to be equal - to another field is validated. - */ -public class ConfirmationRule: Rule { - /// parameter confirmField: field to which original text field will be compared to. - private let confirmField: ValidatableField - /// parameter message: String of error message. - private var message : String - - /** - Initializes a `ConfirmationRule` object to validate the text of a field that should equal the text of another field. - - - parameter confirmField: field to which original field will be compared to. - - parameter message: String of error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(confirmField: ValidatableField, message : String = "This field does not match"){ - self.confirmField = confirmField - self.message = message - } - - /** - Used to validate a field. - - - parameter value: String to checked for validation. - - returns: A boolean value. True if validation is successful; False if validation fails. - */ - public func validate(_ value: String) -> Bool { - return confirmField.validationText == value - } - - /** - Displays an error message when text field fails validation. - - - returns: String of error message. - */ - public func errorMessage() -> String { - return message - } -} diff --git a/SwiftValidator/Rules/EmailRule.swift b/SwiftValidator/Rules/EmailRule.swift deleted file mode 100644 index e2609b1..0000000 --- a/SwiftValidator/Rules/EmailRule.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// EmailValidation.swift -// -// Created by Jeff Potter on 11/11/14. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation - -/** - `EmailRule` is a subclass of RegexRule that defines how a email is validated. - */ -public class EmailRule: RegexRule { - - /// Regular express string to be used in validation. - static let regex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}" - - /** - Initializes an `EmailRule` object to validate an email field. - - - parameter message: String of error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public convenience init(message : String = "Must be a valid email address"){ - self.init(regex: EmailRule.regex, message: message) - } -} \ No newline at end of file diff --git a/SwiftValidator/Rules/ExactLengthRule.swift b/SwiftValidator/Rules/ExactLengthRule.swift deleted file mode 100644 index 4798bd9..0000000 --- a/SwiftValidator/Rules/ExactLengthRule.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// ExactLengthRule.swift -// Validator -// -// Created by Jeff Potter on 2/3/16. -// Copyright © 2016 jpotts18. All rights reserved. -// - -import Foundation - -/** - `ExactLengthRule` is a subclass of Rule that is used to make sure a the text of a field is an exact length. - */ -public class ExactLengthRule : Rule { - /// parameter message: String of error message. - private var message : String = "Must be at most 16 characters long" - /// parameter length: Integer value string length - private var length : Int - - /** - Initializes an `ExactLengthRule` object to validate the text of a field against an exact length. - - - parameter length: Integer value of exact string length being specified. - - parameter message: String of error message. - - returns: An initialized `ExactLengthRule` object, or nil if an object could not be created for some reason. that would not result in an exception. - */ - public init(length: Int, message : String = "Must be exactly %ld characters long"){ - self.length = length - self.message = String(format: message, self.length) - } - - /** - Used to validate a field. - - - parameter value: String to checked for validation. - - returns: A boolean value. True if validation is successful; False if validation fails. - */ - public func validate(_ value: String) -> Bool { - return value.count == length - } - - /** - Displays error message if a field fails validation. - - - returns: String of error message. - */ - public func errorMessage() -> String { - return message - } -} diff --git a/SwiftValidator/Rules/FloatRule.swift b/SwiftValidator/Rules/FloatRule.swift deleted file mode 100644 index 669c0e0..0000000 --- a/SwiftValidator/Rules/FloatRule.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// FloatRule.swift -// Validator -// -// Created by Cameron McCord on 5/5/15. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation - -/** - `FloatRule` is a subclass of Rule that defines how check if a value is a floating point value. - */ -public class FloatRule:Rule { - /// Error message to be displayed if validation fails. - private var message : String - - /** - Initializes a `FloatRule` object to validate that the text of a field is a floating point number. - - - parameter message: String of error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(message : String = "This must be a number with or without a decimal"){ - self.message = message - } - - /** - Used to validate field. - - - parameter value: String to checked for validation. - - returns: Boolean value. True if validation is successful; False if validation fails. - */ - public func validate(_ value: String) -> Bool { - let regex = try? NSRegularExpression(pattern: "^[-+]?(\\d*[.])?\\d+$", options: []) - if let regex = regex { - let match = regex.numberOfMatches(in: value, options: [], range: NSRange(location: 0, length: value.count)) - return match == 1 - } - return false - } - - /** - Displays error message when field fails validation. - - - returns: String of error message. - */ - public func errorMessage() -> String { - return message - } -} diff --git a/SwiftValidator/Rules/FullNameRule.swift b/SwiftValidator/Rules/FullNameRule.swift deleted file mode 100644 index de94c49..0000000 --- a/SwiftValidator/Rules/FullNameRule.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// FullNameValidation.swift -// -// Created by Jeff Potter on 11/19/14. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation - -/** - `FullNameRule` is a subclass of Rule that defines how a full name is validated. - */ -public class FullNameRule : Rule { - /// Error message to be displayed if validation fails. - private var message : String - - /** - Initializes a `FullNameRule` object that is used to verify that text in field is a full name. - - - parameter message: String of error message. - - returns: An initialized `FullNameRule` object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(message : String = "Please provide a first & last name"){ - self.message = message - } - - /** - Used to validate a field. - - - parameter value: String to checked for validation. - - returns: A boolean value. True if validation is successful; False if validation fails. - */ - public func validate(_ value: String) -> Bool { - let nameArray: [String] = value.split { $0 == " " }.map { String($0) } - return nameArray.count >= 2 - } - - /** - Used to display error message of a field that has failed validation. - - - returns: String of error message. - */ - public func errorMessage() -> String { - return message - } -} diff --git a/SwiftValidator/Rules/HexColorRule.swift b/SwiftValidator/Rules/HexColorRule.swift deleted file mode 100644 index 10c5fa7..0000000 --- a/SwiftValidator/Rules/HexColorRule.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// HexColorRule.swift -// Validator -// -// Created by Bhargav Gurlanka on 2/4/16. -// Copyright © 2016 jpotts18. All rights reserved. -// - -import Foundation - -/** - `HexColorRule` is a subclass of `RegexRule`. It is used to verify whether a field is a hexadecimal color. - */ -public class HexColorRule: RegexRule { - /// Regular expression string that is used to verify hexadecimal - static let regex = "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$" - - /** - Initializes a `HexaColorRule` object to verify that field has text in hexadecimal color format. - - - parameter message: String of error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(message: String = "Invalid regular expression") { - super.init(regex: HexColorRule.regex, message: message) - } -} \ No newline at end of file diff --git a/SwiftValidator/Rules/IPV4Rule.swift b/SwiftValidator/Rules/IPV4Rule.swift deleted file mode 100644 index 3ed7948..0000000 --- a/SwiftValidator/Rules/IPV4Rule.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// IPV4Rule.swift -// Validator -// -// Created by Bhargav Gurlanka on 2/4/16. -// Copyright © 2016 jpotts18. All rights reserved. -// - -import Foundation - -/** - `IPV4Rule` is a subclass of RegexRule that defines how a IPV4 address validated. - */ -public class IPV4Rule: RegexRule { - /// Regular expression string that is used to verify IPV4 address. - static let regex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$" - - /** - Initializes a `IPV4Rule` object to verify that field has text is an IPV4Rule address. - - - parameter message: String of error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(message: String = "Must be a valid IPV4 address") { - super.init(regex: IPV4Rule.regex, message: message) - } -} diff --git a/SwiftValidator/Rules/ISBNRule.swift b/SwiftValidator/Rules/ISBNRule.swift deleted file mode 100644 index 4d39b0e..0000000 --- a/SwiftValidator/Rules/ISBNRule.swift +++ /dev/null @@ -1,191 +0,0 @@ -// -// ISBNRule.swift -// Validator -// -// Created by Bhargav Gurlanka on 2/4/16. -// Copyright © 2016 jpotts18. All rights reserved. -// - -import Foundation - -/** - `ISBNRule` is a subclass of `Rule`. It is used to verify whether a field is a valid ISBN number. - */ -public class ISBNRule: Rule { - - /// String that holds error message - private let message: String - - /** - Initializes a `ISBNRule` object to verify that field has text that is a ISBN number. - - - parameter message: String of error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(message: String = "Enter valid ISBN number") { - self.message = message - } - - /** - Method used to validate field. - - - parameter value: String to checked for validation. - - returns: Boolean value. True if validation is successful; False if validation fails. - */ - public func validate(_ value: String) -> Bool { - - guard let regex = try? NSRegularExpression(pattern: "[\\s-]", options: []) else { - fatalError("Invalid ISBN sanitizing regex") - } - - let sanitized = regex.stringByReplacingMatches(in: value, options: [], range: NSMakeRange(0, value.count), withTemplate: "") - - return ISBN10Validator().verify(sanitized) || ISBN13Validator().verify(sanitized) - } - - /** - Method used to dispaly error message when field fails validation. - - - returns: String of error message. - */ - public func errorMessage() -> String { - return message; - } -} - -/** - `ISBNValidator` defines the protocol that objects adopting it must implement. -*/ -private protocol ISBNValidator { - /// Regular expression string - var regex: String { get } - - /** - Method that actually verifies a ISBN number. - - - parameter input: String that is to be validated against `ISBNRule` - - returns: A `Bool` that represents what happened during verification. `false` is returned if - it fails, `true` is returned if it was a success. - */ - func verify(_ input: String) -> Bool - /** - Method that verifies regular expression is valid. - - - parameter input: String that holds ISBN number being validated. - - returns: A `Bool` that represents the status of the ISBN number. `false` if ISBN number - was not valid, `true` if it was valid. - */ - func checkRegex(_ input: String) -> Bool - - /** - Method that verifies `ISBN` being validated is itself valid. It has to be either ISBN10 - or ISBN13. - - - parameter input: String that holds ISBN number being validated. - - returns: A `Bool` that represents the status of the ISBN number. `false` if ISBN number - was not valid, `true` if it was valid. - */ - func verifyChecksum(_ input: String) -> Bool -} - -/** - `ISBNValidator` defines the extensions that are added to `ISBNValidator`. - */ -extension ISBNValidator { - - /** - Method that actually verifies a ISBN number. - - - parameter input: String that is to be validated against `ISBNRule` - - returns: A `Bool` that represents what happened during verification. `false` is returned if - it fails, `true` is returned if it was a success. - */ - func verify(_ input: String) -> Bool { - return checkRegex(input) && verifyChecksum(input) - } - - /** - Method that verifies `ISBN` being validated is itself valid. It has to be either ISBN10 - or ISBN13. - - - parameter input: String that holds ISBN number being validated. - - returns: A `Bool` that represents the status of the ISBN number. `false` if ISBN number - was not valid, `true` if it was valid. - */ - func checkRegex(_ input: String) -> Bool { - guard let _ = input.range(of: regex, options: [.regularExpression, .anchored]) else { - return false - } - - return true - } -} - -/** - `ISBN10Validator` is a struct that adopts the `ISBNValidator` protocol. Used to validate that - a field is an ISBN10 number. -*/ -private struct ISBN10Validator: ISBNValidator { - /// Regular expression used to validate ISBN10 number - let regex = "^(?:[0-9]{9}X|[0-9]{10})$" - - - /** - Checks that a string is an ISBN10 number. - - - parameter input: String that is checked for ISBN10 validation. - - returns: `true` if string is a valid ISBN10 and `false` if it is not. - */ - fileprivate func verifyChecksum(_ input: String) -> Bool { - var checksum = 0 - - for i in 0..<9 { - if let intCharacter = Int(String(input[input.index(input.startIndex, offsetBy: i)])) { - checksum += (i + 1) * intCharacter - } - } - - if (input[input.index(input.startIndex, offsetBy: 9)] == "X") { - checksum += 10 * 10 - } else { - if let intCharacter = Int(String(input[input.index(input.startIndex, offsetBy: 9)])) { - checksum += 10 * intCharacter - } - } - - return ((checksum % 11) == 0) - } -} - -/** - `ISBN13Validator` is a struct that adopts the `ISBNValidator` protocol. Used to validate that - a field is an ISBN13 number. -*/ -private struct ISBN13Validator: ISBNValidator { - /// Regular expression used to validate ISBN13 number. - let regex = "^(?:[0-9]{13})$" - - /** - Checks that a string is an ISBN13 number. - - - parameter input: String that is checked for ISBN13 validation. - - returns: `true` if string is a valid ISBN13 and `false` if it is not. - */ - fileprivate func verifyChecksum(_ input: String) -> Bool { - let factor = [1, 3] - var checksum = 0 - - for i in 0..<12 { - if let intCharacter = Int(String(input[input.index(input.startIndex, offsetBy: i)])) { - print("\(factor[i%2]) * \(intCharacter)") - checksum += factor[i % 2] * intCharacter - } - } - - if let lastInt = Int(String(input[input.index(input.startIndex, offsetBy: 12)])) { - return (lastInt - ((10 - (checksum % 10)) % 10) == 0) - } - - return false - } -} diff --git a/SwiftValidator/Rules/MaxLengthRule.swift b/SwiftValidator/Rules/MaxLengthRule.swift deleted file mode 100644 index 0c65d81..0000000 --- a/SwiftValidator/Rules/MaxLengthRule.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// MaxLengthRule.swift -// Validator -// -// Created by Guilherme Berger on 4/6/15. -// - -import Foundation - -/** - `MaxLengthRule` is a subclass of `Rule` that defines how maximum character length is validated. - */ -public class MaxLengthRule: Rule { - /// Default maximum character length. - private var DEFAULT_LENGTH: Int = 16 - /// Error message to be displayed if validation fails. - private var message : String = "Must be at most 16 characters long" - /// - returns: An initialized `MaxLengthRule` object, or nil if an object could not be created for some reason that would not result in an exception. - public init(){} - - /** - Initializes a `MaxLengthRule` object that is to validate the length of the text of a field. - - - parameter length: Maximum character length. - - parameter message: String of error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(length: Int, message : String = "Must be at most %ld characters long"){ - self.DEFAULT_LENGTH = length - self.message = String(format: message, self.DEFAULT_LENGTH) - } - - /** - Used to validate a field. - - - parameter value: String to checked for validation. - - returns: A boolean value. True if validation is successful; False if validation fails. - */ - public func validate(_ value: String) -> Bool { - return value.count <= DEFAULT_LENGTH - } - - /** - Displays an error message if a field fails validation. - - - returns: String of error message. - */ - public func errorMessage() -> String { - return message - } -} diff --git a/SwiftValidator/Rules/MinLengthRule.swift b/SwiftValidator/Rules/MinLengthRule.swift deleted file mode 100644 index b83166d..0000000 --- a/SwiftValidator/Rules/MinLengthRule.swift +++ /dev/null @@ -1,52 +0,0 @@ -// -// LengthRule.swift -// Validator -// -// Created by Jeff Potter on 3/6/15. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation - -/** - `MinLengthRule` is a subclass of Rule that defines how minimum character length is validated. - */ -public class MinLengthRule: Rule { - /// Default minimum character length. - private var DEFAULT_LENGTH: Int = 3 - /// Default error message to be displayed if validation fails. - private var message : String = "Must be at least 3 characters long" - - /// - returns: An initialized `MinLengthRule` object, or nil if an object could not be created for some reason that would not result in an exception. - public init(){} - - /** - Initializes a `MaxLengthRule` object that is to validate the length of the text of a field. - - - parameter length: Minimum character length. - - parameter message: String of error message. - - returns: An initialized `MinLengthRule` object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(length: Int, message : String = "Must be at least %ld characters long"){ - self.DEFAULT_LENGTH = length - self.message = String(format: message, self.DEFAULT_LENGTH) - } - - /** - Validates a field. - - parameter value: String to checked for validation. - - returns: A boolean value. True if validation is successful; False if validation fails. - */ - public func validate(_ value: String) -> Bool { - return value.count >= DEFAULT_LENGTH - } - - /** - Displays error message when field has failed validation. - - - returns: String of error message. - */ - public func errorMessage() -> String { - return message - } -} diff --git a/SwiftValidator/Rules/PasswordRule.swift b/SwiftValidator/Rules/PasswordRule.swift deleted file mode 100644 index 2fa8872..0000000 --- a/SwiftValidator/Rules/PasswordRule.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// PasswordValidation.swift -// -// Created by Jeff Potter on 11/13/14. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation - -/** - `PasswordRule` is a subclass of RegexRule that defines how a password is validated. - */ -public class PasswordRule : RegexRule { - - // Alternative Regexes - - // 8 characters. One uppercase. One Lowercase. One number. - // static let regex = "^(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[a-z]).{8,}$" - // - // no length. One uppercase. One lowercae. One number. - // static let regex = "^(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[a-z]).*?$" - - /// Regular express string to be used in validation. - static let regex = "^(?=.*?[A-Z]).{8,}$" - - /** - Initializes a `PasswordRule` object that will validate a field is a valid password. - - - parameter message: String of error message. - - returns: An initialized `PasswordRule` object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public convenience init(message : String = "Must be 8 characters with 1 uppercase") { - self.init(regex: PasswordRule.regex, message : message) - } -} \ No newline at end of file diff --git a/SwiftValidator/Rules/PhoneNumberRule.swift b/SwiftValidator/Rules/PhoneNumberRule.swift deleted file mode 100644 index e8dd546..0000000 --- a/SwiftValidator/Rules/PhoneNumberRule.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// PhoneValidation.swift -// -// Created by Jeff Potter on 11/11/14. -// Copyright (c) 2014 Byron Mackay. All rights reserved. -// - -import Foundation - -/** - `PhoneNumberRule` is a subclass of Rule that defines how a phone number is validated. - */ -public class PhoneNumberRule: RegexRule { -// let PHONE_REGEX = "^\\d{3}-\\d{3}-\\d{4}$" - - /// Phone number regular express string to be used in validation. - static let regex = "^\\d{10}$" - - /** - Initializes a `PhoneNumberRule` object. Used to validate that a field has a valid phone number. - - - parameter message: Error message that is displayed if validation fails. - - returns: An initialized `PasswordRule` object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public convenience init(message : String = "Enter a valid 10 digit phone number") { - self.init(regex: PhoneNumberRule.regex, message : message) - } - -} diff --git a/SwiftValidator/Rules/RegexRule.swift b/SwiftValidator/Rules/RegexRule.swift deleted file mode 100644 index fcbc033..0000000 --- a/SwiftValidator/Rules/RegexRule.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// RegexRule.swift -// Validator -// -// Created by Jeff Potter on 4/3/15. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation - -/** - `RegexRule` is a subclass of Rule that defines how a regular expression is validated. - */ -open class RegexRule : Rule { - /// Regular express string to be used in validation. - private var REGEX: String = "^(?=.*?[A-Z]).{8,}$" - /// String that holds error message. - private var message : String - - /** - Method used to initialize `RegexRule` object. - - - parameter regex: Regular expression string to be used in validation. - - parameter message: String of error message. - - returns: An initialized `RegexRule` object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(regex: String, message: String = "Invalid Regular Expression"){ - self.REGEX = regex - self.message = message - } - - /** - Method used to validate field. - - - parameter value: String to checked for validation. - - returns: Boolean value. True if validation is successful; False if validation fails. - */ - open func validate(_ value: String) -> Bool { - let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX) - return test.evaluate(with: value) - } - - /** - Method used to dispaly error message when field fails validation. - - - returns: String of error message. - */ - open func errorMessage() -> String { - return message - } -} diff --git a/SwiftValidator/Rules/RequiredRule.swift b/SwiftValidator/Rules/RequiredRule.swift deleted file mode 100644 index dc87ce7..0000000 --- a/SwiftValidator/Rules/RequiredRule.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// Required.swift -// pyur-ios -// -// Created by Jeff Potter on 12/22/14. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation - -/** - `RequiredRule` is a subclass of Rule that defines how a required field is validated. - */ -open class RequiredRule: Rule { - /// String that holds error message. - private var message : String - - /** - Initializes `RequiredRule` object with error message. Used to validate a field that requires text. - - - parameter message: String of error message. - - returns: An initialized `RequiredRule` object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(message : String = "This field is required"){ - self.message = message - } - - /** - Validates a field. - - - parameter value: String to check for validation. - - returns: Boolean value. True if validation is successful; False if validation fails. - */ - open func validate(_ value: String) -> Bool { - return !value.isEmpty - } - - /** - Used to display error message when validation fails. - - - returns: String of error message. - */ - open func errorMessage() -> String { - return message - } -} diff --git a/SwiftValidator/Rules/Rule.swift b/SwiftValidator/Rules/Rule.swift deleted file mode 100644 index 2f621c9..0000000 --- a/SwiftValidator/Rules/Rule.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// Validation.swift -// -// Created by Jeff Potter on 11/11/14. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation - -/** - The `Rule` protocol declares the required methods for all objects that subscribe to it. - */ -public protocol Rule { - /** - Validates text of a field. - - - parameter value: String of text to be validated. - - returns: Boolean value. True if validation is successful; False if validation fails. - */ - func validate(_ value: String) -> Bool - /** - Displays error message of a field that has failed validation. - - - returns: String of error message. - */ - func errorMessage() -> String -} diff --git a/SwiftValidator/Rules/ValidationRule.swift b/SwiftValidator/Rules/ValidationRule.swift deleted file mode 100644 index ef8d306..0000000 --- a/SwiftValidator/Rules/ValidationRule.swift +++ /dev/null @@ -1,45 +0,0 @@ -// -// ValidationRule.swift -// -// Created by Jeff Potter on 11/11/14. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation -import UIKit - -/** - `ValidationRule` is a class that creates an object which holds validation info of a field. - */ -public class ValidationRule { - /// the field of the field - public var field:ValidatableField - /// the errorLabel of the field - public var errorLabel:UILabel? - /// the rules of the field - public var rules:[Rule] = [] - - /** - Initializes `ValidationRule` instance with field, rules, and errorLabel. - - - parameter field: field that holds actual text in field. - - parameter errorLabel: label that holds error label of field. - - parameter rules: array of Rule objects, which field will be validated against. - - returns: An initialized `ValidationRule` object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public init(field: ValidatableField, rules:[Rule], errorLabel:UILabel?){ - self.field = field - self.errorLabel = errorLabel - self.rules = rules - } - - /** - Used to validate field against its validation rules. - - returns: `ValidationError` object if at least one error is found. Nil is returned if there are no validation errors. - */ - public func validateField() -> ValidationError? { - return rules.filter{ - return !$0.validate(field.validationText) - }.map{ rule -> ValidationError in return ValidationError(field: self.field, errorLabel:self.errorLabel, error: rule.errorMessage()) }.first - } -} diff --git a/SwiftValidator/Rules/ZipCodeRule.swift b/SwiftValidator/Rules/ZipCodeRule.swift deleted file mode 100644 index f418db6..0000000 --- a/SwiftValidator/Rules/ZipCodeRule.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// ZipCodeRule.swift -// Validator -// -// Created by Jeff Potter on 3/6/15. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -import Foundation - -/** - `ZipCodeRule` is a subclass of `RegexRule` that represents how zip codes are to be validated. - */ -public class ZipCodeRule: RegexRule { - /** - Initializes a `ZipCodeRule` object. - - - parameter message: String that holds error message. - - returns: An initialized object, or nil if an object could not be created for some reason that would not result in an exception. - */ - public convenience init(message : String = "Enter a valid 5 or 9 digit zipcode"){ - self.init(regex: "\\d{5}(-\\d{4})?", message : message) - } -} diff --git a/SwiftValidator/SwiftValidator.h b/SwiftValidator/SwiftValidator.h deleted file mode 100644 index ad88bfb..0000000 --- a/SwiftValidator/SwiftValidator.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// SwiftValidator.h -// SwiftValidator -// -// Created by Rusty Zarse on 9/3/15. -// Copyright (c) 2015 jpotts18. All rights reserved. -// - -#import - -//! Project version number for SwiftValidator. -FOUNDATION_EXPORT double SwiftValidatorVersionNumber; - -//! Project version string for SwiftValidator. -FOUNDATION_EXPORT const unsigned char SwiftValidatorVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/SwiftValidatorTests/Info.plist b/SwiftValidatorTests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/SwiftValidatorTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/SwiftValidatorTests/SwiftValidatorTests.swift b/SwiftValidatorTests/SwiftValidatorTests.swift deleted file mode 100644 index 4672e21..0000000 --- a/SwiftValidatorTests/SwiftValidatorTests.swift +++ /dev/null @@ -1,486 +0,0 @@ -// -// SwiftValidatorTests.swift -// SwiftValidatorTests -// -// Created by Jeff Potter on 11/20/14. -// Copyright (c) 2014 jpotts18. All rights reserved. -// - -import UIKit -import XCTest -import Validator // example app -import SwiftValidator // framework - -class SwiftValidatorTests: XCTestCase { - - let USERNAME_REGEX = "^[a-z0-9_-]{3,16}$" - - let VALID_ZIP = "12345" - let INVALID_ZIP = "1234" - - let VALID_EMAIL = "jiggy@gmail.com" - let INVALID_EMAIL = "This is not a valid email" - - let CONFIRM_TXT_FIELD = UITextField() - let CONFIRM_TEXT = "Confirm this!" - let CONFIRM_TEXT_DIFF = "I am not the same as the string above" - - let VALID_PASSWORD = "Super$ecret" - let INVALID_PASSWORD = "abc" - - let VALID_FLOAT = "1234.444" - let INVALID_FLOAT = "1234.44.44" - - let VALID_CARD_EXPIRY_MONTH = "10" - let INVALID_CARD_EXPIRY_MONTH = "13" - - let VALID_CARD_EXPIRY_YEAR = "2018" - let INVALID_CARD_EXPIRY_YEAR = "2016" - - let LEN_3 = "hey" - let LEN_5 = "Howdy" - let LEN_20 = "Paint the cat orange" - - let REGISTER_TXT_VIEW = UITextView() - let REGISTER_TXT_FIELD = UITextField() - let REGISTER_VALIDATOR = Validator() - let REGISTER_RULES = [Rule]() - - let UNREGISTER_TXT_FIELD = UITextField() - let UNREGISTER_VALIDATOR = Validator() - let UNREGISTER_RULES = [Rule]() - - let UNREGISTER_ERRORS_TXT_FIELD = UITextField() - let UNREGISTER_ERRORS_VALIDATOR = Validator() - - let ERROR_LABEL = UILabel() - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - - // MARK: Expiry Month - - func testCardExpiryMonthValid() { - XCTAssertTrue(CardExpiryMonthRule().validate(VALID_CARD_EXPIRY_MONTH), "Expiry month Should be valid") - } - - func testCardExpiryMonthInvalid() { - XCTAssertFalse(CardExpiryMonthRule().validate(INVALID_CARD_EXPIRY_MONTH), "Expiry month Should be invalid") - } - - func testCardExpiryMonthmessage() { - XCTAssertNotNil(CardExpiryMonthRule().errorMessage()) - } - - // MARK: Expiry Year - - func testCardExpiryYearValid() { - XCTAssertTrue(CardExpiryYearRule().validate(VALID_CARD_EXPIRY_YEAR), "Expiry year Should be valid") - } - - func testCardExpiryYearInvalid() { - XCTAssertFalse(CardExpiryYearRule().validate(INVALID_CARD_EXPIRY_YEAR), "Expiry year Should be invalid") - } - - func testCardExpiryYearmessage() { - XCTAssertNotNil(CardExpiryYearRule().errorMessage()) - } - - - // MARK: Required - - func testRequired() { - XCTAssertTrue(RequiredRule().validate("Something"), "Required should be valid") - } - - func testRequiredInvalid() { - XCTAssertFalse(RequiredRule().validate(""), "Required should be invalid") - } - - func testRequiredMessage() { - XCTAssertNotNil(RequiredRule().errorMessage()) - } - - // MARK: Regex - - func testRegex(){ - XCTAssertTrue(RegexRule(regex: USERNAME_REGEX).validate("darth_vader8"), "RegexRule should be valid") - } - - func testRegexInvalid(){ - XCTAssertFalse(RegexRule(regex: USERNAME_REGEX).validate("DarthVader"), "RegexRule should be invalid") - } - - func testRegexMessage() { - XCTAssertNotNil(RegexRule(regex: USERNAME_REGEX).errorMessage()) - } - - // MARK: Zipcode - - func testZipCode() { - XCTAssertTrue(ZipCodeRule().validate(VALID_ZIP), "Zipcode should be valid") - } - - func testZipCodeInvalid() { - XCTAssertFalse(ZipCodeRule().validate(INVALID_ZIP), "Zipcode should be invalid") - } - - func testZipCodeMessage() { - XCTAssertNotNil(ZipCodeRule().errorMessage()) - } - - // MARK: Email - - func testEmail() { - XCTAssertTrue(EmailRule().validate(VALID_EMAIL), "Email should be valid") - } - - func testEmailInvalid() { - XCTAssertFalse(EmailRule().validate(INVALID_EMAIL), "Email should be invalid") - } - - func testEmailMessage() { - XCTAssertNotNil(EmailRule().errorMessage()) - } - - // MARK: Float - - func testFloat() { - XCTAssert(FloatRule().validate(VALID_FLOAT), "Float should be valid") - } - - func testFloatInvalid() { - XCTAssert(!FloatRule().validate(INVALID_FLOAT), "Float should be invalid") - XCTAssert(!FloatRule().validate(VALID_EMAIL), "Float should be invalid") - } - - func testFloatMessage() { - XCTAssertNotNil(FloatRule().errorMessage()) - } - - // MARK: Confirm against field - - func testConfirmSame(){ - CONFIRM_TXT_FIELD.text = CONFIRM_TEXT - XCTAssertTrue(ConfirmationRule(confirmField: CONFIRM_TXT_FIELD).validate(CONFIRM_TEXT), "Should confirm successfully") - } - - func testConfirmDifferent() { - CONFIRM_TXT_FIELD.text = CONFIRM_TEXT - XCTAssertFalse(ConfirmationRule(confirmField: CONFIRM_TXT_FIELD).validate(CONFIRM_TEXT_DIFF), "Should fail confirm") - } - - func testConfirmMessage() { - CONFIRM_TXT_FIELD.text = CONFIRM_TEXT - XCTAssertNotNil(ConfirmationRule(confirmField: CONFIRM_TXT_FIELD).errorMessage()) - } - - // MARK: Password - - func testPassword() { - XCTAssertTrue(PasswordRule().validate(VALID_PASSWORD), "Password should be valid") - } - - func testPasswordInvalid(){ - XCTAssertFalse(PasswordRule().validate(INVALID_PASSWORD), "Password is invalid") - } - - func testPasswordMessage() { - XCTAssertNotNil(PasswordRule().errorMessage()) - } - - func testPhoneNumber() { - XCTAssertTrue(PhoneNumberRule().validate("1234567890"), "Phone number should valid") - } - - func testPhoneNumberInvalid() { - XCTAssertFalse(PhoneNumberRule().validate("12345678901"), "Phone number should be invalid") - } - - func testPhoneNumberMessage() { - XCTAssertNotNil(PhoneNumberRule().errorMessage()) - } - - // MARK: Max Length - - func testMaxLength(){ - XCTAssertTrue(MaxLengthRule().validate(LEN_3),"Max Length should be valid") - } - - func testMaxLengthInvalid(){ - XCTAssertFalse(MaxLengthRule().validate(LEN_20),"Max Length should be invalid") - } - - func testMaxLengthParameterAndGreaterThan(){ - XCTAssertTrue(MaxLengthRule(length: 20).validate(LEN_20), "Max Length should be 20 and <= length") - } - - func testMaxLengthMessage() { - XCTAssertNotNil(MaxLengthRule(length: 20).errorMessage()) - } - - // MARK: Min Length - func testMinLength(){ - XCTAssertTrue(MinLengthRule().validate(LEN_3),"Min Length should be valid") - } - - func testMinLengthInvalid(){ - XCTAssertFalse(MinLengthRule().validate("no"),"Min Length should be Invalid") - } - - func testMinLengthWithParameter(){ - XCTAssertTrue(MinLengthRule(length: 5).validate(LEN_5), "Min Len should be set to 5 and >= length") - } - - func testMinLengthMessage() { - XCTAssertNotNil(MinLengthRule(length: 5).errorMessage()) - } - - func testExactLength(){ - XCTAssertTrue(ExactLengthRule(length: 5).validate(LEN_5), "Exact Len should be exactly 5") - } - - func testExactLengthInvalidGreaterThan(){ - XCTAssertFalse(ExactLengthRule(length: 6).validate(LEN_5), "Exact Len should be Invalid") - } - - func testExactLengthInvalidLessThan(){ - XCTAssertFalse(ExactLengthRule(length: 4).validate(LEN_5), "Exact Len should be Invalid") - } - - func testExactLengthMessage() { - XCTAssertNotNil(ExactLengthRule(length: 4).errorMessage()) - } - - // MARK: Full Name - - func testFullName(){ - XCTAssertTrue(FullNameRule().validate("Jeff Potter"), "Full Name should be valid") - } - - func testFullNameWith3Names(){ - XCTAssertTrue(FullNameRule().validate("Jeff Van Buren"), "Full Name should be valid") - } - - func testFullNameInvalid(){ - XCTAssertFalse(FullNameRule().validate("Carl"), "Full Name should be invalid") - } - - // MARK: ISBN - - func testValidISBN10() { - let validISBN10 = ["3836221195", "3-8362-2119-5", "3 8362 2119 5" , "1617290858", "1-61729-085-8", "1 61729 085-8" , "0007269706", "0-00-726970-6", "0 00 726970 6" , "3423214120", "3-423-21412-0", "3 423 21412 0", "340101319X", "3-401-01319-X", "3 401 01319 X"] - - for ISBN10 in validISBN10 { - XCTAssertTrue(ISBNRule().validate(ISBN10), "\(ISBN10) should be valid") - } - } - - func testInvalidISBN10() { - let invalidISBN10 = ["3423214121", "3-423-21412-1", "3 423 21412 1"] - - for ISBN10 in invalidISBN10 { - XCTAssertFalse(ISBNRule().validate(ISBN10), "\(ISBN10) should be invalid") - } - } - - // MARK: HexColor - - func testValidHexColors() { - let validHexes = ["#ff0034", "#CCCCCC", "fff", "#f00"] - for hex in validHexes { - XCTAssertTrue(HexColorRule().validate(hex), "\(hex) should be a valid Hex") - } - } - - func testInvalidHexColors() { - let validHexes = ["#ff", "fff0", "#ff12FG", ""] - for hex in validHexes { - XCTAssertFalse(HexColorRule().validate(hex), "\(hex) should be invalid Hex") - } - } - - //MARK: IPV4 - - func testValidIPV4() { - let validIPV4 = ["127.0.0.1" , "0.0.0.0" , "255.255.255.255" , "1.2.3.4"] - for ipv4 in validIPV4 { - XCTAssertTrue(IPV4Rule().validate(ipv4), "\(ipv4) should be a valid IPV4 address") - } - } - - func testInvalidIPV4() { - let invalidIPV4 = ["::1" , "2001:db8:0000:1:1:1:1:1" , "::ffff:127.0.0.1"] - for ipv4 in invalidIPV4 { - XCTAssertFalse(IPV4Rule().validate(ipv4), "\(ipv4) should be invalid IPV4 address") - } - } - - //MARK: AlphaNumeric - - func testValidAlphaNumeric() { - let validAlphaNumeric = ["abc123", "A1B2C35555"] - for alphaNum in validAlphaNumeric { - XCTAssertTrue(AlphaNumericRule().validate(alphaNum), "\(alphaNum) should be a valid alpha numeric string") - } - } - - func testInvalidAlphaNumeric() { - let invalidAlphaNumeric = ["abc ", "!!!!!", "ABC@DAGQW%!^$@%"] - for alphaNum in invalidAlphaNumeric { - XCTAssertFalse(AlphaNumericRule().validate(alphaNum), "\(alphaNum) should be invalid alpha numeric string") - } - } - - //MARK: Alpha - - func testValidAlpha() { - let validAlphaStrings = ["abc", "ABCDEFG", "AabeVsDvaW"] - for alpha in validAlphaStrings { - XCTAssertTrue(AlphaRule().validate(alpha), "\(alpha) should be valid alpha string") - } - } - - func testInvalidAlpha() { - let invalidAlphaStrings = ["abc1", " foo "] - for alpha in invalidAlphaStrings { - XCTAssertFalse(AlphaRule().validate(alpha), "\(alpha) should be invalid alpha string") - } - } - - // MARK: Register Field - func testRegisterTextView(){ - REGISTER_VALIDATOR.registerField(REGISTER_TXT_VIEW, rules: REGISTER_RULES) - XCTAssert(REGISTER_VALIDATOR.validations[REGISTER_TXT_VIEW] != nil, "Textfield should register") - } - - func testRegisterTextField(){ - REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, rules: REGISTER_RULES) - XCTAssert(REGISTER_VALIDATOR.validations[REGISTER_TXT_FIELD] != nil, "Textfield should register") - } - - func testUnregisterTextField(){ - UNREGISTER_VALIDATOR.registerField(UNREGISTER_TXT_FIELD, rules: UNREGISTER_RULES) - UNREGISTER_VALIDATOR.unregisterField(UNREGISTER_TXT_FIELD) - XCTAssert(UNREGISTER_VALIDATOR.validations[UNREGISTER_TXT_FIELD] == nil, "Textfield should unregister") - } - - func testUnregisterError(){ - UNREGISTER_ERRORS_VALIDATOR.registerField(UNREGISTER_ERRORS_TXT_FIELD, rules: [EmailRule()]) - UNREGISTER_ERRORS_TXT_FIELD.text = INVALID_EMAIL - UNREGISTER_ERRORS_VALIDATOR.validate { (errors) -> Void in - XCTAssert(errors.count == 1, "Should come back with errors") - } - UNREGISTER_ERRORS_VALIDATOR.unregisterField(UNREGISTER_ERRORS_TXT_FIELD) - UNREGISTER_ERRORS_VALIDATOR.validate { (errors) -> Void in - XCTAssert(errors.count == 0, "Should not come back with errors") - } - } - - // MARK: Validate Functions - - func testValidateWithCallback() { - REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, rules: [EmailRule()]) - REGISTER_TXT_FIELD.text = VALID_EMAIL - REGISTER_VALIDATOR.validate { (errors) -> Void in - XCTAssert(errors.count == 0, "Should not come back with errors") - } - REGISTER_TXT_FIELD.text = INVALID_EMAIL - REGISTER_VALIDATOR.validate { (errors) -> Void in - XCTAssert(errors.count == 1, "Should come back with 1 error") - } - } - - func testValidateSingleField() { - REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, rules: [EmailRule()]) - REGISTER_TXT_FIELD.text = VALID_EMAIL - REGISTER_VALIDATOR.validateField(REGISTER_TXT_FIELD) { error in - XCTAssert(error == nil, "Should not present error") - } - REGISTER_TXT_FIELD.text = INVALID_EMAIL - REGISTER_VALIDATOR.validateField(REGISTER_TXT_FIELD) { error in - XCTAssert(error?.errorMessage.characters.count ?? 0 > 0, "Should state 'invalid email'") - } - } - - func testValidateTextViewField() { - REGISTER_VALIDATOR.registerField(REGISTER_TXT_VIEW, rules: [RequiredRule()]) - REGISTER_TXT_VIEW.text = "Some notes" - REGISTER_VALIDATOR.validateField(REGISTER_TXT_VIEW) { error in - XCTAssert(error == nil, "Should not present error") - } - REGISTER_TXT_VIEW.text = nil - REGISTER_VALIDATOR.validateField(REGISTER_TXT_VIEW) { error in - XCTAssert(error!.errorMessage == "This field is required") - } - } - - // MARK: Validate error field gets it's text set to the error, if supplied - - func testNoErrorMessageSet() { - REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, errorLabel: ERROR_LABEL, rules: [EmailRule()]) - REGISTER_TXT_FIELD.text = VALID_EMAIL - REGISTER_VALIDATOR.validate { (errors) -> Void in - XCTAssert(errors.count == 0, "Should not come back with errors") - } - } - - func testErrorMessageSet() { - REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, errorLabel: ERROR_LABEL, rules: [EmailRule()]) - var successCount = 0 - var errorCount = 0 - REGISTER_VALIDATOR.styleTransformers(success: { (validationRule) -> Void in - successCount+=1 - }) { (validationError) -> Void in - errorCount+=1 - } - REGISTER_TXT_FIELD.text = INVALID_EMAIL - REGISTER_VALIDATOR.validate { (errors) -> Void in - XCTAssert(errors.count == 1, "Should come back with errors") - XCTAssert(errorCount == 1, "Should have called the error style transform once") - XCTAssert(successCount == 0, "Should not have called the success style transform as there are no successful fields") - } - } - - func testErrorMessageSetAndThenUnset() { - REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, errorLabel: ERROR_LABEL, rules: [EmailRule()]) - - var successCount = 0 - var errorCount = 0 - REGISTER_VALIDATOR.styleTransformers(success: { (validationRule) -> Void in - successCount+=1 - }) { (validationError) -> Void in - errorCount+=1 - } - - REGISTER_TXT_FIELD.text = INVALID_EMAIL - REGISTER_VALIDATOR.validate { (errors) -> Void in - XCTAssert(errors.count == 1, "Should come back with errors") - XCTAssert(errorCount == 1, "Should have called the error style transform once") - XCTAssert(successCount == 0, "Should not have called the success style transform as there are no successful fields") - self.REGISTER_TXT_FIELD.text = self.VALID_EMAIL - self.REGISTER_VALIDATOR.validate { (errors) -> Void in - XCTAssert(errors.count == 0, "Should not come back with errors: \(errors)") - XCTAssert(successCount == 1, "Should have called the success style transform once") - XCTAssert(errorCount == 1, "Should not have called the error style transform again") - } - } - } - - func testTextFieldBorderColorNotSet() { - REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, errorLabel: ERROR_LABEL, rules: [EmailRule()]) - REGISTER_TXT_FIELD.text = INVALID_EMAIL - REGISTER_VALIDATOR.validate { (errors) -> Void in - XCTAssert(errors.count == 1, "Should come back with errors") - XCTAssert(!(self.REGISTER_TXT_FIELD.layer.borderColor! == UIColor.red.cgColor), "Color shouldn't get set at all") - } - } -} diff --git a/Validator.xcodeproj/project.pbxproj b/Validator.xcodeproj/project.pbxproj deleted file mode 100644 index b160122..0000000 --- a/Validator.xcodeproj/project.pbxproj +++ /dev/null @@ -1,748 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 62C1821D1C6312F5003788E7 /* ExactLengthRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62C1821C1C6312F5003788E7 /* ExactLengthRule.swift */; }; - 62D9B2561C7C0B2A00BAFCE3 /* ValidationDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62D9B2551C7C0B2A00BAFCE3 /* ValidationDelegate.swift */; }; - 7CC1E4CF1C636B4500AF013C /* AlphaRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1E4CE1C636B4500AF013C /* AlphaRule.swift */; }; - 7CC1E4D11C637A7700AF013C /* AlphaNumericRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1E4D01C637A7700AF013C /* AlphaNumericRule.swift */; }; - 7CC1E4D31C637ABC00AF013C /* CharacterSetRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1E4D21C637ABC00AF013C /* CharacterSetRule.swift */; }; - 7CC1E4D51C637C8500AF013C /* IPV4Rule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1E4D41C637C8500AF013C /* IPV4Rule.swift */; }; - 7CC1E4D71C637F6E00AF013C /* ISBNRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1E4D61C637F6E00AF013C /* ISBNRule.swift */; }; - 7CC1E4DB1C63BFA600AF013C /* HexColorRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1E4DA1C63BFA600AF013C /* HexColorRule.swift */; }; - C87F606A1E2B678B00EB8429 /* CardExpiryMonthRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = C87F60691E2B678B00EB8429 /* CardExpiryMonthRule.swift */; }; - C87F606C1E2B68C900EB8429 /* CardExpiryYearRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = C87F606B1E2B68C900EB8429 /* CardExpiryYearRule.swift */; }; - FB465CB81B9884F400398388 /* SwiftValidator.h in Headers */ = {isa = PBXBuildFile; fileRef = FB465CB71B9884F400398388 /* SwiftValidator.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FB465CBE1B9884F400398388 /* SwiftValidator.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB465CB31B9884F400398388 /* SwiftValidator.framework */; }; - FB465CC71B9884F400398388 /* SwiftValidatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CC61B9884F400398388 /* SwiftValidatorTests.swift */; }; - FB465CF31B9889EA00398388 /* ConfirmRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CE31B9889EA00398388 /* ConfirmRule.swift */; }; - FB465CF41B9889EA00398388 /* EmailRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CE41B9889EA00398388 /* EmailRule.swift */; }; - FB465CF51B9889EA00398388 /* FloatRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CE51B9889EA00398388 /* FloatRule.swift */; }; - FB465CF61B9889EA00398388 /* FullNameRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CE61B9889EA00398388 /* FullNameRule.swift */; }; - FB465CF71B9889EA00398388 /* MaxLengthRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CE71B9889EA00398388 /* MaxLengthRule.swift */; }; - FB465CF81B9889EA00398388 /* MinLengthRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CE81B9889EA00398388 /* MinLengthRule.swift */; }; - FB465CF91B9889EA00398388 /* PasswordRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CE91B9889EA00398388 /* PasswordRule.swift */; }; - FB465CFA1B9889EA00398388 /* PhoneNumberRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CEA1B9889EA00398388 /* PhoneNumberRule.swift */; }; - FB465CFB1B9889EA00398388 /* RegexRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CEB1B9889EA00398388 /* RegexRule.swift */; }; - FB465CFC1B9889EA00398388 /* RequiredRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CEC1B9889EA00398388 /* RequiredRule.swift */; }; - FB465CFD1B9889EA00398388 /* Rule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CED1B9889EA00398388 /* Rule.swift */; }; - FB465CFE1B9889EA00398388 /* ValidationRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CEE1B9889EA00398388 /* ValidationRule.swift */; }; - FB465CFF1B9889EA00398388 /* ZipCodeRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CEF1B9889EA00398388 /* ZipCodeRule.swift */; }; - FB465D001B9889EA00398388 /* ValidationError.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CF11B9889EA00398388 /* ValidationError.swift */; }; - FB465D011B9889EA00398388 /* Validator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB465CF21B9889EA00398388 /* Validator.swift */; }; - FB51E5B01CD208B8004DE696 /* Validatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB51E5AF1CD208B8004DE696 /* Validatable.swift */; }; - FBA963631CDA10130071F03E /* ValidatorDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBA963621CDA10130071F03E /* ValidatorDictionary.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - FB465CBF1B9884F400398388 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 62D1AE0F1A1E6D4400E4DFF8 /* Project object */; - proxyType = 1; - remoteGlobalIDString = FB465CB21B9884F400398388; - remoteInfo = SwiftValidator; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 62C1821C1C6312F5003788E7 /* ExactLengthRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExactLengthRule.swift; sourceTree = ""; }; - 62D1AE1B1A1E6D4400E4DFF8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 62D1AE1C1A1E6D4400E4DFF8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 62D1AE1E1A1E6D4400E4DFF8 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - 62D1AE211A1E6D4400E4DFF8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 62D1AE231A1E6D4400E4DFF8 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 62D1AE261A1E6D4400E4DFF8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 62D1AE2C1A1E6D4500E4DFF8 /* ValidatorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ValidatorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 62D1AE311A1E6D4500E4DFF8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 62D9B2551C7C0B2A00BAFCE3 /* ValidationDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidationDelegate.swift; sourceTree = ""; }; - 7CC1E4CE1C636B4500AF013C /* AlphaRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlphaRule.swift; sourceTree = ""; }; - 7CC1E4D01C637A7700AF013C /* AlphaNumericRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlphaNumericRule.swift; sourceTree = ""; }; - 7CC1E4D21C637ABC00AF013C /* CharacterSetRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharacterSetRule.swift; sourceTree = ""; }; - 7CC1E4D41C637C8500AF013C /* IPV4Rule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IPV4Rule.swift; sourceTree = ""; }; - 7CC1E4D61C637F6E00AF013C /* ISBNRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ISBNRule.swift; sourceTree = ""; }; - 7CC1E4DA1C63BFA600AF013C /* HexColorRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HexColorRule.swift; sourceTree = ""; }; - C87F60691E2B678B00EB8429 /* CardExpiryMonthRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardExpiryMonthRule.swift; sourceTree = ""; }; - C87F606B1E2B68C900EB8429 /* CardExpiryYearRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardExpiryYearRule.swift; sourceTree = ""; }; - FB465CB31B9884F400398388 /* SwiftValidator.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftValidator.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FB465CB61B9884F400398388 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - FB465CB71B9884F400398388 /* SwiftValidator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftValidator.h; sourceTree = ""; }; - FB465CBD1B9884F400398388 /* SwiftValidatorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftValidatorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - FB465CC51B9884F400398388 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - FB465CC61B9884F400398388 /* SwiftValidatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftValidatorTests.swift; sourceTree = ""; }; - FB465CE31B9889EA00398388 /* ConfirmRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfirmRule.swift; sourceTree = ""; }; - FB465CE41B9889EA00398388 /* EmailRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmailRule.swift; sourceTree = ""; }; - FB465CE51B9889EA00398388 /* FloatRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FloatRule.swift; sourceTree = ""; }; - FB465CE61B9889EA00398388 /* FullNameRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FullNameRule.swift; sourceTree = ""; }; - FB465CE71B9889EA00398388 /* MaxLengthRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaxLengthRule.swift; sourceTree = ""; }; - FB465CE81B9889EA00398388 /* MinLengthRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MinLengthRule.swift; sourceTree = ""; }; - FB465CE91B9889EA00398388 /* PasswordRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordRule.swift; sourceTree = ""; }; - FB465CEA1B9889EA00398388 /* PhoneNumberRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhoneNumberRule.swift; sourceTree = ""; }; - FB465CEB1B9889EA00398388 /* RegexRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RegexRule.swift; sourceTree = ""; }; - FB465CEC1B9889EA00398388 /* RequiredRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequiredRule.swift; sourceTree = ""; }; - FB465CED1B9889EA00398388 /* Rule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Rule.swift; sourceTree = ""; }; - FB465CEE1B9889EA00398388 /* ValidationRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidationRule.swift; sourceTree = ""; }; - FB465CEF1B9889EA00398388 /* ZipCodeRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZipCodeRule.swift; sourceTree = ""; }; - FB465CF11B9889EA00398388 /* ValidationError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidationError.swift; sourceTree = ""; }; - FB465CF21B9889EA00398388 /* Validator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Validator.swift; sourceTree = ""; }; - FB51E5AF1CD208B8004DE696 /* Validatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Validatable.swift; sourceTree = ""; }; - FBA963621CDA10130071F03E /* ValidatorDictionary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidatorDictionary.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 62D1AE291A1E6D4500E4DFF8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FB465CAF1B9884F400398388 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FB465CBA1B9884F400398388 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FB465CBE1B9884F400398388 /* SwiftValidator.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 62D1AE0E1A1E6D4400E4DFF8 = { - isa = PBXGroup; - children = ( - 62D1AE191A1E6D4400E4DFF8 /* Validator */, - 62D1AE2F1A1E6D4500E4DFF8 /* ValidatorTests */, - FB465CB41B9884F400398388 /* SwiftValidator */, - FB465CC31B9884F400398388 /* SwiftValidatorTests */, - 62D1AE181A1E6D4400E4DFF8 /* Products */, - ); - sourceTree = ""; - }; - 62D1AE181A1E6D4400E4DFF8 /* Products */ = { - isa = PBXGroup; - children = ( - 62D1AE2C1A1E6D4500E4DFF8 /* ValidatorTests.xctest */, - FB465CB31B9884F400398388 /* SwiftValidator.framework */, - FB465CBD1B9884F400398388 /* SwiftValidatorTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 62D1AE191A1E6D4400E4DFF8 /* Validator */ = { - isa = PBXGroup; - children = ( - 62D1AE1C1A1E6D4400E4DFF8 /* AppDelegate.swift */, - 62D1AE1E1A1E6D4400E4DFF8 /* ViewController.swift */, - 62D1AE201A1E6D4400E4DFF8 /* Main.storyboard */, - 62D1AE231A1E6D4400E4DFF8 /* Images.xcassets */, - 62D1AE251A1E6D4400E4DFF8 /* LaunchScreen.xib */, - 62D1AE1A1A1E6D4400E4DFF8 /* Supporting Files */, - ); - path = Validator; - sourceTree = ""; - }; - 62D1AE1A1A1E6D4400E4DFF8 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 62D1AE1B1A1E6D4400E4DFF8 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 62D1AE2F1A1E6D4500E4DFF8 /* ValidatorTests */ = { - isa = PBXGroup; - children = ( - 62D1AE301A1E6D4500E4DFF8 /* Supporting Files */, - ); - path = ValidatorTests; - sourceTree = ""; - }; - 62D1AE301A1E6D4500E4DFF8 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 62D1AE311A1E6D4500E4DFF8 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - FB465CB41B9884F400398388 /* SwiftValidator */ = { - isa = PBXGroup; - children = ( - FB465CE21B9889EA00398388 /* Rules */, - FB465CF01B9889EA00398388 /* Core */, - FB465CB71B9884F400398388 /* SwiftValidator.h */, - FB465CB51B9884F400398388 /* Supporting Files */, - ); - path = SwiftValidator; - sourceTree = ""; - }; - FB465CB51B9884F400398388 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - FB465CB61B9884F400398388 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - FB465CC31B9884F400398388 /* SwiftValidatorTests */ = { - isa = PBXGroup; - children = ( - FB465CC61B9884F400398388 /* SwiftValidatorTests.swift */, - FB465CC41B9884F400398388 /* Supporting Files */, - ); - path = SwiftValidatorTests; - sourceTree = ""; - }; - FB465CC41B9884F400398388 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - FB465CC51B9884F400398388 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - FB465CE21B9889EA00398388 /* Rules */ = { - isa = PBXGroup; - children = ( - 7CC1E4CE1C636B4500AF013C /* AlphaRule.swift */, - C87F606B1E2B68C900EB8429 /* CardExpiryYearRule.swift */, - C87F60691E2B678B00EB8429 /* CardExpiryMonthRule.swift */, - 7CC1E4D01C637A7700AF013C /* AlphaNumericRule.swift */, - 7CC1E4D21C637ABC00AF013C /* CharacterSetRule.swift */, - 7CC1E4D41C637C8500AF013C /* IPV4Rule.swift */, - 7CC1E4D61C637F6E00AF013C /* ISBNRule.swift */, - 7CC1E4DA1C63BFA600AF013C /* HexColorRule.swift */, - FB465CE31B9889EA00398388 /* ConfirmRule.swift */, - FB465CE41B9889EA00398388 /* EmailRule.swift */, - FB465CE51B9889EA00398388 /* FloatRule.swift */, - FB465CE61B9889EA00398388 /* FullNameRule.swift */, - FB465CE71B9889EA00398388 /* MaxLengthRule.swift */, - FB465CE81B9889EA00398388 /* MinLengthRule.swift */, - FB465CE91B9889EA00398388 /* PasswordRule.swift */, - FB465CEA1B9889EA00398388 /* PhoneNumberRule.swift */, - FB465CEB1B9889EA00398388 /* RegexRule.swift */, - FB465CEC1B9889EA00398388 /* RequiredRule.swift */, - FB465CED1B9889EA00398388 /* Rule.swift */, - FB465CEE1B9889EA00398388 /* ValidationRule.swift */, - FB465CEF1B9889EA00398388 /* ZipCodeRule.swift */, - 62C1821C1C6312F5003788E7 /* ExactLengthRule.swift */, - ); - path = Rules; - sourceTree = ""; - }; - FB465CF01B9889EA00398388 /* Core */ = { - isa = PBXGroup; - children = ( - 62D9B2551C7C0B2A00BAFCE3 /* ValidationDelegate.swift */, - FB465CF11B9889EA00398388 /* ValidationError.swift */, - FB465CF21B9889EA00398388 /* Validator.swift */, - FB51E5AF1CD208B8004DE696 /* Validatable.swift */, - FBA963621CDA10130071F03E /* ValidatorDictionary.swift */, - ); - path = Core; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - FB465CB01B9884F400398388 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - FB465CB81B9884F400398388 /* SwiftValidator.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 62D1AE2B1A1E6D4500E4DFF8 /* ValidatorTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 62D1AE391A1E6D4500E4DFF8 /* Build configuration list for PBXNativeTarget "ValidatorTests" */; - buildPhases = ( - 62D1AE281A1E6D4500E4DFF8 /* Sources */, - 62D1AE291A1E6D4500E4DFF8 /* Frameworks */, - 62D1AE2A1A1E6D4500E4DFF8 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ValidatorTests; - productName = ValidatorTests; - productReference = 62D1AE2C1A1E6D4500E4DFF8 /* ValidatorTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - FB465CB21B9884F400398388 /* SwiftValidator */ = { - isa = PBXNativeTarget; - buildConfigurationList = FB465CD01B9884F400398388 /* Build configuration list for PBXNativeTarget "SwiftValidator" */; - buildPhases = ( - FB465CAE1B9884F400398388 /* Sources */, - FB465CAF1B9884F400398388 /* Frameworks */, - FB465CB01B9884F400398388 /* Headers */, - FB465CB11B9884F400398388 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SwiftValidator; - productName = SwiftValidator; - productReference = FB465CB31B9884F400398388 /* SwiftValidator.framework */; - productType = "com.apple.product-type.framework"; - }; - FB465CBC1B9884F400398388 /* SwiftValidatorTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = FB465CD21B9884F400398388 /* Build configuration list for PBXNativeTarget "SwiftValidatorTests" */; - buildPhases = ( - FB465CB91B9884F400398388 /* Sources */, - FB465CBA1B9884F400398388 /* Frameworks */, - FB465CBB1B9884F400398388 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - FB465CC01B9884F400398388 /* PBXTargetDependency */, - ); - name = SwiftValidatorTests; - productName = SwiftValidatorTests; - productReference = FB465CBD1B9884F400398388 /* SwiftValidatorTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 62D1AE0F1A1E6D4400E4DFF8 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftMigration = 0700; - LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0930; - ORGANIZATIONNAME = jpotts18; - TargetAttributes = { - 62D1AE2B1A1E6D4500E4DFF8 = { - CreatedOnToolsVersion = 6.1; - LastSwiftMigration = 0820; - TestTargetID = 62D1AE161A1E6D4400E4DFF8; - }; - FB465CB21B9884F400398388 = { - CreatedOnToolsVersion = 6.4; - LastSwiftMigration = 1020; - }; - FB465CBC1B9884F400398388 = { - CreatedOnToolsVersion = 6.4; - LastSwiftMigration = 1020; - TestTargetID = 62D1AE161A1E6D4400E4DFF8; - }; - }; - }; - buildConfigurationList = 62D1AE121A1E6D4400E4DFF8 /* Build configuration list for PBXProject "Validator" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 62D1AE0E1A1E6D4400E4DFF8; - productRefGroup = 62D1AE181A1E6D4400E4DFF8 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 62D1AE2B1A1E6D4500E4DFF8 /* ValidatorTests */, - FB465CB21B9884F400398388 /* SwiftValidator */, - FB465CBC1B9884F400398388 /* SwiftValidatorTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 62D1AE2A1A1E6D4500E4DFF8 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FB465CB11B9884F400398388 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FB465CBB1B9884F400398388 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 62D1AE281A1E6D4500E4DFF8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FB465CAE1B9884F400398388 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - FB465CF41B9889EA00398388 /* EmailRule.swift in Sources */, - FB465CF61B9889EA00398388 /* FullNameRule.swift in Sources */, - FBA963631CDA10130071F03E /* ValidatorDictionary.swift in Sources */, - FB465CFF1B9889EA00398388 /* ZipCodeRule.swift in Sources */, - FB465CF91B9889EA00398388 /* PasswordRule.swift in Sources */, - 7CC1E4D11C637A7700AF013C /* AlphaNumericRule.swift in Sources */, - 7CC1E4D31C637ABC00AF013C /* CharacterSetRule.swift in Sources */, - FB465CFD1B9889EA00398388 /* Rule.swift in Sources */, - FB465CFA1B9889EA00398388 /* PhoneNumberRule.swift in Sources */, - FB465CF51B9889EA00398388 /* FloatRule.swift in Sources */, - C87F606C1E2B68C900EB8429 /* CardExpiryYearRule.swift in Sources */, - 7CC1E4DB1C63BFA600AF013C /* HexColorRule.swift in Sources */, - FB465D011B9889EA00398388 /* Validator.swift in Sources */, - FB465CFE1B9889EA00398388 /* ValidationRule.swift in Sources */, - C87F606A1E2B678B00EB8429 /* CardExpiryMonthRule.swift in Sources */, - FB465CF31B9889EA00398388 /* ConfirmRule.swift in Sources */, - FB51E5B01CD208B8004DE696 /* Validatable.swift in Sources */, - 7CC1E4D51C637C8500AF013C /* IPV4Rule.swift in Sources */, - 7CC1E4D71C637F6E00AF013C /* ISBNRule.swift in Sources */, - FB465D001B9889EA00398388 /* ValidationError.swift in Sources */, - FB465CFC1B9889EA00398388 /* RequiredRule.swift in Sources */, - FB465CFB1B9889EA00398388 /* RegexRule.swift in Sources */, - 7CC1E4CF1C636B4500AF013C /* AlphaRule.swift in Sources */, - 62D9B2561C7C0B2A00BAFCE3 /* ValidationDelegate.swift in Sources */, - FB465CF81B9889EA00398388 /* MinLengthRule.swift in Sources */, - FB465CF71B9889EA00398388 /* MaxLengthRule.swift in Sources */, - 62C1821D1C6312F5003788E7 /* ExactLengthRule.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FB465CB91B9884F400398388 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - FB465CC71B9884F400398388 /* SwiftValidatorTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - FB465CC01B9884F400398388 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = FB465CB21B9884F400398388 /* SwiftValidator */; - targetProxy = FB465CBF1B9884F400398388 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 62D1AE201A1E6D4400E4DFF8 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 62D1AE211A1E6D4400E4DFF8 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 62D1AE251A1E6D4400E4DFF8 /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 62D1AE261A1E6D4400E4DFF8 /* Base */, - ); - name = LaunchScreen.xib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 62D1AE341A1E6D4500E4DFF8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; - }; - name = Debug; - }; - 62D1AE351A1E6D4500E4DFF8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_VERSION = 4.2; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 62D1AE3A1A1E6D4500E4DFF8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ENABLE_MODULES = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = ValidatorTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator"; - }; - name = Debug; - }; - 62D1AE3B1A1E6D4500E4DFF8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ENABLE_MODULES = YES; - INFOPLIST_FILE = ValidatorTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator"; - }; - name = Release; - }; - FB465CCC1B9884F400398388 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = SwiftValidator/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - FB465CCD1B9884F400398388 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = SwiftValidator/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - FB465CCE1B9884F400398388 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = SwiftValidatorTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.levous.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator"; - }; - name = Debug; - }; - FB465CCF1B9884F400398388 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = SwiftValidatorTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.levous.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 62D1AE121A1E6D4400E4DFF8 /* Build configuration list for PBXProject "Validator" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 62D1AE341A1E6D4500E4DFF8 /* Debug */, - 62D1AE351A1E6D4500E4DFF8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 62D1AE391A1E6D4500E4DFF8 /* Build configuration list for PBXNativeTarget "ValidatorTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 62D1AE3A1A1E6D4500E4DFF8 /* Debug */, - 62D1AE3B1A1E6D4500E4DFF8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - FB465CD01B9884F400398388 /* Build configuration list for PBXNativeTarget "SwiftValidator" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - FB465CCC1B9884F400398388 /* Debug */, - FB465CCD1B9884F400398388 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - FB465CD21B9884F400398388 /* Build configuration list for PBXNativeTarget "SwiftValidatorTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - FB465CCE1B9884F400398388 /* Debug */, - FB465CCF1B9884F400398388 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 62D1AE0F1A1E6D4400E4DFF8 /* Project object */; -} diff --git a/Validator.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Validator.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index c457bdb..0000000 --- a/Validator.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Validator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Validator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/Validator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Validator.xcodeproj/xcshareddata/xcschemes/SwiftValidator.xcscheme b/Validator.xcodeproj/xcshareddata/xcschemes/SwiftValidator.xcscheme deleted file mode 100644 index d6ae464..0000000 --- a/Validator.xcodeproj/xcshareddata/xcschemes/SwiftValidator.xcscheme +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Validator.xcodeproj/xcshareddata/xcschemes/SwiftValidatorTests.xcscheme b/Validator.xcodeproj/xcshareddata/xcschemes/SwiftValidatorTests.xcscheme deleted file mode 100644 index d88d081..0000000 --- a/Validator.xcodeproj/xcshareddata/xcschemes/SwiftValidatorTests.xcscheme +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Validator.xcodeproj/xcshareddata/xcschemes/Validator.xcscheme b/Validator.xcodeproj/xcshareddata/xcschemes/Validator.xcscheme deleted file mode 100644 index 5da1196..0000000 --- a/Validator.xcodeproj/xcshareddata/xcschemes/Validator.xcscheme +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Validator/AppDelegate.swift b/Validator/AppDelegate.swift deleted file mode 100644 index 598ba7a..0000000 --- a/Validator/AppDelegate.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// AppDelegate.swift -// Validator -// -// Created by Jeff Potter on 11/20/14. -// Copyright (c) 2014 jpotts18. All rights reserved. -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - return true - } -} - diff --git a/Validator/Base.lproj/LaunchScreen.xib b/Validator/Base.lproj/LaunchScreen.xib deleted file mode 100644 index 2277799..0000000 --- a/Validator/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Validator/Base.lproj/Main.storyboard b/Validator/Base.lproj/Main.storyboard deleted file mode 100644 index 35799c5..0000000 --- a/Validator/Base.lproj/Main.storyboard +++ /dev/null @@ -1,476 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Validator/Images.xcassets/AppIcon.appiconset/Contents.json b/Validator/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index b8236c6..0000000 --- a/Validator/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Validator/Info.plist b/Validator/Info.plist deleted file mode 100644 index 6905cc6..0000000 --- a/Validator/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/Validator/ViewController.swift b/Validator/ViewController.swift deleted file mode 100644 index d04244a..0000000 --- a/Validator/ViewController.swift +++ /dev/null @@ -1,108 +0,0 @@ -// -// ViewController.swift -// Validator -// -// Created by Jeff Potter on 11/20/14. -// Copyright (c) 2014 jpotts18. All rights reserved. -// - -import Foundation -import UIKit -import SwiftValidator - -class ViewController: UIViewController , ValidationDelegate, UITextFieldDelegate { - - // TextFields - @IBOutlet weak var fullNameTextField: UITextField! - @IBOutlet weak var emailTextField: UITextField! - @IBOutlet weak var phoneNumberTextField: UITextField! - @IBOutlet weak var zipcodeTextField: UITextField! - @IBOutlet weak var emailConfirmTextField: UITextField! - @IBOutlet weak var notesTextView: UITextView! - - // Error Labels - @IBOutlet weak var fullNameErrorLabel: UILabel! - @IBOutlet weak var emailErrorLabel: UILabel! - @IBOutlet weak var phoneNumberErrorLabel: UILabel! - @IBOutlet weak var zipcodeErrorLabel: UILabel! - @IBOutlet weak var emailConfirmErrorLabel: UILabel! - @IBOutlet weak var notesErrorLabel: UILabel! - - let validator = Validator() - - override func viewDidLoad() { - super.viewDidLoad() - - self.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(ViewController.hideKeyboard))) - - validator.styleTransformers(success:{ (validationRule) -> Void in - print("here") - // clear error label - validationRule.errorLabel?.isHidden = true - validationRule.errorLabel?.text = "" - - if let textField = validationRule.field as? UITextField { - textField.layer.borderColor = UIColor.green.cgColor - textField.layer.borderWidth = 0.5 - } else if let textField = validationRule.field as? UITextView { - textField.layer.borderColor = UIColor.green.cgColor - textField.layer.borderWidth = 0.5 - } - }, error:{ (validationError) -> Void in - print("error") - validationError.errorLabel?.isHidden = false - validationError.errorLabel?.text = validationError.errorMessage - if let textField = validationError.field as? UITextField { - textField.layer.borderColor = UIColor.red.cgColor - textField.layer.borderWidth = 1.0 - } else if let textField = validationError.field as? UITextView { - textField.layer.borderColor = UIColor.red.cgColor - textField.layer.borderWidth = 1.0 - } - }) - - validator.registerField(fullNameTextField, errorLabel: fullNameErrorLabel , rules: [RequiredRule(), FullNameRule()]) - validator.registerField(emailTextField, errorLabel: emailErrorLabel, rules: [RequiredRule(), EmailRule()]) - validator.registerField(emailConfirmTextField, errorLabel: emailConfirmErrorLabel, rules: [RequiredRule(), ConfirmationRule(confirmField: emailTextField)]) - validator.registerField(phoneNumberTextField, errorLabel: phoneNumberErrorLabel, rules: [RequiredRule(), MinLengthRule(length: 9)]) - validator.registerField(zipcodeTextField, errorLabel: zipcodeErrorLabel, rules: [RequiredRule(), ZipCodeRule()]) - validator.registerField(notesTextView, errorLabel: notesErrorLabel, rules: [RequiredRule()]) - } - - @IBAction func submitTapped(_ sender: AnyObject) { - print("Validating...") - validator.validate(self) - } - - // MARK: ValidationDelegate Methods - - func validationSuccessful() { - print("Validation Success!") - let alert = UIAlertController(title: "Success", message: "You are validated!", preferredStyle: UIAlertController.Style.alert) - let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil) - alert.addAction(defaultAction) - self.present(alert, animated: true, completion: nil) - - } - func validationFailed(_ errors:[(Validatable, ValidationError)]) { - print("Validation FAILED!") - } - - @objc func hideKeyboard(){ - self.view.endEditing(true) - } - - // MARK: Validate single field - // Don't forget to use UITextFieldDelegate - func textFieldShouldReturn(_ textField: UITextField) -> Bool { - validator.validateField(textField){ error in - if error == nil { - // Field validation was successful - } else { - // Validation error occurred - } - } - return true - } - -} diff --git a/ValidatorTests/Info.plist b/ValidatorTests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/ValidatorTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/docs/css/highlight.css b/css/highlight.css similarity index 100% rename from docs/css/highlight.css rename to css/highlight.css diff --git a/docs/css/jazzy.css b/css/jazzy.css similarity index 100% rename from docs/css/jazzy.css rename to css/jazzy.css diff --git a/docs/docsets/SwiftValidator.docset/Contents/Info.plist b/docsets/SwiftValidator.docset/Contents/Info.plist similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Info.plist rename to docsets/SwiftValidator.docset/Contents/Info.plist diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/AlphaNumericRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/AlphaNumericRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/AlphaNumericRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/AlphaNumericRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/AlphaRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/AlphaRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/AlphaRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/AlphaRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/CharacterSetRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/CharacterSetRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/CharacterSetRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/CharacterSetRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ConfirmationRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ConfirmationRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ConfirmationRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ConfirmationRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/EmailRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/EmailRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/EmailRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/EmailRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ExactLengthRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ExactLengthRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ExactLengthRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ExactLengthRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/FloatRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/FloatRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/FloatRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/FloatRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/FullNameRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/FullNameRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/FullNameRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/FullNameRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/HexColorRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/HexColorRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/HexColorRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/HexColorRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/IPV4Rule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/IPV4Rule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/IPV4Rule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/IPV4Rule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ISBNRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ISBNRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ISBNRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ISBNRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/MaxLengthRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/MaxLengthRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/MaxLengthRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/MaxLengthRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/MinLengthRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/MinLengthRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/MinLengthRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/MinLengthRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/PasswordRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/PasswordRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/PasswordRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/PasswordRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/PhoneNumberRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/PhoneNumberRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/PhoneNumberRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/PhoneNumberRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/RegexRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/RegexRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/RegexRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/RegexRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/RequiredRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/RequiredRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/RequiredRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/RequiredRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ValidationError.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ValidationError.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ValidationError.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ValidationError.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ValidationRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ValidationRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ValidationRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ValidationRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/Validator.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/Validator.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/Validator.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/Validator.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ZipCodeRule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ZipCodeRule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ZipCodeRule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Classes/ZipCodeRule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols/Rule.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols/Rule.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols/Rule.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols/Rule.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols/ValidationDelegate.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols/ValidationDelegate.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols/ValidationDelegate.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/Protocols/ValidationDelegate.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/css/highlight.css b/docsets/SwiftValidator.docset/Contents/Resources/Documents/css/highlight.css similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/css/highlight.css rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/css/highlight.css diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/css/jazzy.css b/docsets/SwiftValidator.docset/Contents/Resources/Documents/css/jazzy.css similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/css/jazzy.css rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/css/jazzy.css diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/img/carat.png b/docsets/SwiftValidator.docset/Contents/Resources/Documents/img/carat.png similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/img/carat.png rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/img/carat.png diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/img/dash.png b/docsets/SwiftValidator.docset/Contents/Resources/Documents/img/dash.png similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/img/dash.png rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/img/dash.png diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/img/gh.png b/docsets/SwiftValidator.docset/Contents/Resources/Documents/img/gh.png similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/img/gh.png rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/img/gh.png diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/index.html b/docsets/SwiftValidator.docset/Contents/Resources/Documents/index.html similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/index.html rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/index.html diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/js/jazzy.js b/docsets/SwiftValidator.docset/Contents/Resources/Documents/js/jazzy.js similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/js/jazzy.js rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/js/jazzy.js diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/js/jquery.min.js b/docsets/SwiftValidator.docset/Contents/Resources/Documents/js/jquery.min.js similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/js/jquery.min.js rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/js/jquery.min.js diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/undocumented.txt b/docsets/SwiftValidator.docset/Contents/Resources/Documents/undocumented.txt similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/Documents/undocumented.txt rename to docsets/SwiftValidator.docset/Contents/Resources/Documents/undocumented.txt diff --git a/docs/docsets/SwiftValidator.docset/Contents/Resources/docSet.dsidx b/docsets/SwiftValidator.docset/Contents/Resources/docSet.dsidx similarity index 100% rename from docs/docsets/SwiftValidator.docset/Contents/Resources/docSet.dsidx rename to docsets/SwiftValidator.docset/Contents/Resources/docSet.dsidx diff --git a/docs/docsets/SwiftValidator.tgz b/docsets/SwiftValidator.tgz similarity index 100% rename from docs/docsets/SwiftValidator.tgz rename to docsets/SwiftValidator.tgz diff --git a/docs/img/carat.png b/img/carat.png similarity index 100% rename from docs/img/carat.png rename to img/carat.png diff --git a/docs/img/dash.png b/img/dash.png similarity index 100% rename from docs/img/dash.png rename to img/dash.png diff --git a/docs/img/gh.png b/img/gh.png similarity index 100% rename from docs/img/gh.png rename to img/gh.png diff --git a/docs/index.html b/index.html similarity index 99% rename from docs/index.html rename to index.html index 6aefe33..58bb2d1 100644 --- a/docs/index.html +++ b/index.html @@ -117,7 +117,7 @@

Swift Validator is a rule-based validation library for Swift.

-

Swift Validator

+

Swift Validator

Core Concepts

    diff --git a/docs/js/jazzy.js b/js/jazzy.js similarity index 100% rename from docs/js/jazzy.js rename to js/jazzy.js diff --git a/docs/js/jquery.min.js b/js/jquery.min.js similarity index 100% rename from docs/js/jquery.min.js rename to js/jquery.min.js diff --git a/swift-validator-v2.gif b/swift-validator-v2.gif deleted file mode 100644 index f213012..0000000 Binary files a/swift-validator-v2.gif and /dev/null differ diff --git a/docs/undocumented.txt b/undocumented.txt similarity index 100% rename from docs/undocumented.txt rename to undocumented.txt