Compare commits
7 Commits
master
...
swift3-dav
| Author | SHA1 | Date |
|---|---|---|
|
|
761df17e04 | |
|
|
5622b3b863 | |
|
|
ecad4da221 | |
|
|
867dbb5b25 | |
|
|
22d3c0e071 | |
|
|
bab425304f | |
|
|
b44c6b09da |
32
.travis.yml
32
.travis.yml
|
|
@ -1,24 +1,20 @@
|
||||||
|
# Docs: https://docs.travis-ci.com/user/osx-ci-environment
|
||||||
language: objective-c
|
language: objective-c
|
||||||
osx_image: xcode8
|
|
||||||
xcode_sdk: iphonesimulator10.0
|
|
||||||
xcode_project: Validator.xcodeproj
|
|
||||||
xcode_scheme: Validator
|
|
||||||
|
|
||||||
|
osx_image:
|
||||||
|
- xcode7.3
|
||||||
|
- xcode8
|
||||||
|
|
||||||
|
xcode_sdk:
|
||||||
|
- iphonesimulator10.0
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- gem install cocoapods -v '0.32.1'
|
- brew update
|
||||||
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
|
- brew outdated xctool || brew upgrade xctool
|
||||||
|
|
||||||
|
script:
|
||||||
|
- pwd
|
||||||
|
- xctool -project Validator.xcodeproj -scheme Validator -sdk iphonesimulator test
|
||||||
|
|
||||||
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:
|
after_success:
|
||||||
|
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
- 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
|
|
||||||
|
|
|
||||||
35
README.md
35
README.md
|
|
@ -1,7 +1,7 @@
|
||||||
SwiftValidator
|
SwiftValidator
|
||||||
===============
|
===============
|
||||||
|
|
||||||
[](https://travis-ci.org/SwiftValidatorCommunity/SwiftValidator) [](https://codecov.io/github/SwiftValidatorCommunity/SwiftValidator?branch=master)
|
[](https://travis-ci.org/jpotts18/SwiftValidator) [](https://github.com/Carthage/Carthage) [](https://codecov.io/github/jpotts18/SwiftValidator?branch=master)
|
||||||
|
|
||||||
Swift Validator is a rule-based validation library for Swift.
|
Swift Validator is a rule-based validation library for Swift.
|
||||||
|
|
||||||
|
|
@ -22,16 +22,11 @@ platform :ios, "8.1"
|
||||||
|
|
||||||
use_frameworks!
|
use_frameworks!
|
||||||
|
|
||||||
# Swift 3
|
# As of 4.0.0, SwiftValidator has been extended beyond UITextField
|
||||||
# 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
|
# 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'
|
pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :tag => '4.0.0'
|
||||||
|
|
||||||
# Swift 2.1 (limited to UITextField validation)
|
# For older versions
|
||||||
pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :tag => '3.0.5'
|
pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :tag => '3.0.5'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -82,7 +77,7 @@ override func viewDidLoad() {
|
||||||
|
|
||||||
// You can now pass in regex and length parameters through overloaded contructors
|
// You can now pass in regex and length parameters through overloaded contructors
|
||||||
validator.registerField(phoneNumberTextField, errorLabel: phoneNumberErrorLabel, rules: [RequiredRule(), MinLengthRule(length: 9)])
|
validator.registerField(phoneNumberTextField, errorLabel: phoneNumberErrorLabel, rules: [RequiredRule(), MinLengthRule(length: 9)])
|
||||||
validator.registerField(zipcodeTextField, errorLabel: zipcodeErrorLabel, rules: [RequiredRule(), ZipCodeRule(regex : "\\d{5}")])
|
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
|
// You can unregister a text field if you no longer want to validate it
|
||||||
validator.unregisterField(fullNameTextField)
|
validator.unregisterField(fullNameTextField)
|
||||||
|
|
@ -107,16 +102,16 @@ func validationSuccessful() {
|
||||||
// submit the form
|
// submit the form
|
||||||
}
|
}
|
||||||
|
|
||||||
func validationFailed(_ errors:[(Validatable ,ValidationError)]) {
|
func validationFailed(errors:[(Validatable ,ValidationError)]) {
|
||||||
// turn the fields to red
|
// turn the fields to red
|
||||||
for (field, error) in errors {
|
for (field, error) in errors {
|
||||||
if let field = field as? UITextField {
|
if let field = field as? UITextField {
|
||||||
field.layer.borderColor = UIColor.red.cgColor
|
field.layer.borderColor = UIColor.redColor().CGColor
|
||||||
field.layer.borderWidth = 1.0
|
field.layer.borderWidth = 1.0
|
||||||
}
|
}
|
||||||
error.errorLabel?.text = error.errorMessage // works if you added labels
|
error.errorLabel?.text = error.errorMessage // works if you added labels
|
||||||
error.errorLabel?.isHidden = false
|
error.errorLabel?.hidden = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
@ -159,7 +154,7 @@ class SSNVRule: RegexRule {
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
Checkout the docs <a href="http://swiftvalidatorcommunity.github.io/SwiftValidator/">here</a> via [@jazzydocs](https://twitter.com/jazzydocs).
|
Checkout the docs <a href="http://jpotts18.github.io/SwiftValidator/">here</a> via [@jazzydocs](https://twitter.com/jazzydocs).
|
||||||
|
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "SwiftValidator"
|
s.name = "SwiftValidator"
|
||||||
s.version = "4.0.2"
|
s.version = "4.0.1"
|
||||||
s.summary = "A UITextField Validation library for Swift"
|
s.summary = "A UITextField Validation library for Swift"
|
||||||
s.homepage = "https://github.com/TouchInstinct/SwiftValidator"
|
s.homepage = "https://github.com/jpotts18/SwiftValidator"
|
||||||
s.screenshots = "https://raw.githubusercontent.com/jpotts18/SwiftValidator/master/swift-validator-v2.gif"
|
s.screenshots = "https://raw.githubusercontent.com/jpotts18/SwiftValidator/master/swift-validator-v2.gif"
|
||||||
s.license = { :type => "MIT", :file => "LICENSE.txt" }
|
s.license = { :type => "MIT", :file => "LICENSE.txt" }
|
||||||
s.author = { "Jeff Potter" => "jeff.potter6@gmail.com" }
|
s.author = { "Jeff Potter" => "jeff.potter6@gmail.com" }
|
||||||
s.social_media_url = "http://twitter.com/jpotts18"
|
s.social_media_url = "http://twitter.com/jpotts18"
|
||||||
s.platform = :ios
|
s.platform = :ios
|
||||||
s.ios.deployment_target = '8.0'
|
s.ios.deployment_target = '10.0'
|
||||||
s.source = { :git => "https://github.com/TouchInstinct/SwiftValidator.git", :tag => s.version }
|
s.source = { :git => "https://github.com/ed-mejia/SwiftValidator.git", :tag => "4.0.1" }
|
||||||
s.source_files = "SwiftValidator/**/*.swift"
|
s.source_files = "SwiftValidator/**/*.swift"
|
||||||
s.exclude_files = "Validator/AppDelegate.swift"
|
s.exclude_files = "Validator/AppDelegate.swift"
|
||||||
s.frameworks = ['Foundation', 'UIKit']
|
s.frameworks = ['Foundation', 'UIKit']
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public class ExactLengthRule : Rule {
|
||||||
- returns: A boolean value. True if validation is successful; False if validation fails.
|
- returns: A boolean value. True if validation is successful; False if validation fails.
|
||||||
*/
|
*/
|
||||||
public func validate(_ value: String) -> Bool {
|
public func validate(_ value: String) -> Bool {
|
||||||
return value.count == length
|
return value.characters.count == length
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public class FloatRule:Rule {
|
||||||
public func validate(_ value: String) -> Bool {
|
public func validate(_ value: String) -> Bool {
|
||||||
let regex = try? NSRegularExpression(pattern: "^[-+]?(\\d*[.])?\\d+$", options: [])
|
let regex = try? NSRegularExpression(pattern: "^[-+]?(\\d*[.])?\\d+$", options: [])
|
||||||
if let regex = regex {
|
if let regex = regex {
|
||||||
let match = regex.numberOfMatches(in: value, options: [], range: NSRange(location: 0, length: value.count))
|
let match = regex.numberOfMatches(in: value, options: [], range: NSRange(location: 0, length: value.characters.count))
|
||||||
return match == 1
|
return match == 1
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public class FullNameRule : Rule {
|
||||||
- returns: A boolean value. True if validation is successful; False if validation fails.
|
- returns: A boolean value. True if validation is successful; False if validation fails.
|
||||||
*/
|
*/
|
||||||
public func validate(_ value: String) -> Bool {
|
public func validate(_ value: String) -> Bool {
|
||||||
let nameArray: [String] = value.split { $0 == " " }.map { String($0) }
|
let nameArray: [String] = value.characters.split { $0 == " " }.map { String($0) }
|
||||||
return nameArray.count >= 2
|
return nameArray.count >= 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class ISBNRule: Rule {
|
||||||
fatalError("Invalid ISBN sanitizing regex")
|
fatalError("Invalid ISBN sanitizing regex")
|
||||||
}
|
}
|
||||||
|
|
||||||
let sanitized = regex.stringByReplacingMatches(in: value, options: [], range: NSMakeRange(0, value.count), withTemplate: "")
|
let sanitized = regex.stringByReplacingMatches(in: value, options: [], range: NSMakeRange(0, value.characters.count), withTemplate: "")
|
||||||
|
|
||||||
return ISBN10Validator().verify(sanitized) || ISBN13Validator().verify(sanitized)
|
return ISBN10Validator().verify(sanitized) || ISBN13Validator().verify(sanitized)
|
||||||
}
|
}
|
||||||
|
|
@ -140,15 +140,15 @@ private struct ISBN10Validator: ISBNValidator {
|
||||||
var checksum = 0
|
var checksum = 0
|
||||||
|
|
||||||
for i in 0..<9 {
|
for i in 0..<9 {
|
||||||
if let intCharacter = Int(String(input[input.index(input.startIndex, offsetBy: i)])) {
|
if let intCharacter = Int(String(input[input.characters.index(input.startIndex, offsetBy: i)])) {
|
||||||
checksum += (i + 1) * intCharacter
|
checksum += (i + 1) * intCharacter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input[input.index(input.startIndex, offsetBy: 9)] == "X") {
|
if (input[input.characters.index(input.startIndex, offsetBy: 9)] == "X") {
|
||||||
checksum += 10 * 10
|
checksum += 10 * 10
|
||||||
} else {
|
} else {
|
||||||
if let intCharacter = Int(String(input[input.index(input.startIndex, offsetBy: 9)])) {
|
if let intCharacter = Int(String(input[input.characters.index(input.startIndex, offsetBy: 9)])) {
|
||||||
checksum += 10 * intCharacter
|
checksum += 10 * intCharacter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -176,13 +176,13 @@ private struct ISBN13Validator: ISBNValidator {
|
||||||
var checksum = 0
|
var checksum = 0
|
||||||
|
|
||||||
for i in 0..<12 {
|
for i in 0..<12 {
|
||||||
if let intCharacter = Int(String(input[input.index(input.startIndex, offsetBy: i)])) {
|
if let intCharacter = Int(String(input[input.characters.index(input.startIndex, offsetBy: i)])) {
|
||||||
print("\(factor[i%2]) * \(intCharacter)")
|
print("\(factor[i%2]) * \(intCharacter)")
|
||||||
checksum += factor[i % 2] * intCharacter
|
checksum += factor[i % 2] * intCharacter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let lastInt = Int(String(input[input.index(input.startIndex, offsetBy: 12)])) {
|
if let lastInt = Int(String(input[input.characters.index(input.startIndex, offsetBy: 12)])) {
|
||||||
return (lastInt - ((10 - (checksum % 10)) % 10) == 0)
|
return (lastInt - ((10 - (checksum % 10)) % 10) == 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ public class MaxLengthRule: Rule {
|
||||||
- returns: A boolean value. True if validation is successful; False if validation fails.
|
- returns: A boolean value. True if validation is successful; False if validation fails.
|
||||||
*/
|
*/
|
||||||
public func validate(_ value: String) -> Bool {
|
public func validate(_ value: String) -> Bool {
|
||||||
return value.count <= DEFAULT_LENGTH
|
return value.characters.count <= DEFAULT_LENGTH
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class MinLengthRule: Rule {
|
||||||
- returns: A boolean value. True if validation is successful; False if validation fails.
|
- returns: A boolean value. True if validation is successful; False if validation fails.
|
||||||
*/
|
*/
|
||||||
public func validate(_ value: String) -> Bool {
|
public func validate(_ value: String) -> Bool {
|
||||||
return value.count >= DEFAULT_LENGTH
|
return value.characters.count >= DEFAULT_LENGTH
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import Foundation
|
||||||
/**
|
/**
|
||||||
`RegexRule` is a subclass of Rule that defines how a regular expression is validated.
|
`RegexRule` is a subclass of Rule that defines how a regular expression is validated.
|
||||||
*/
|
*/
|
||||||
open class RegexRule : Rule {
|
public class RegexRule : Rule {
|
||||||
/// Regular express string to be used in validation.
|
/// Regular express string to be used in validation.
|
||||||
private var REGEX: String = "^(?=.*?[A-Z]).{8,}$"
|
private var REGEX: String = "^(?=.*?[A-Z]).{8,}$"
|
||||||
/// String that holds error message.
|
/// String that holds error message.
|
||||||
|
|
@ -35,7 +35,7 @@ open class RegexRule : Rule {
|
||||||
- parameter value: String to checked for validation.
|
- parameter value: String to checked for validation.
|
||||||
- returns: Boolean value. True if validation is successful; False if validation fails.
|
- returns: Boolean value. True if validation is successful; False if validation fails.
|
||||||
*/
|
*/
|
||||||
open func validate(_ value: String) -> Bool {
|
public func validate(_ value: String) -> Bool {
|
||||||
let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX)
|
let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX)
|
||||||
return test.evaluate(with: value)
|
return test.evaluate(with: value)
|
||||||
}
|
}
|
||||||
|
|
@ -45,7 +45,7 @@ open class RegexRule : Rule {
|
||||||
|
|
||||||
- returns: String of error message.
|
- returns: String of error message.
|
||||||
*/
|
*/
|
||||||
open func errorMessage() -> String {
|
public func errorMessage() -> String {
|
||||||
return message
|
return message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import Foundation
|
||||||
/**
|
/**
|
||||||
`RequiredRule` is a subclass of Rule that defines how a required field is validated.
|
`RequiredRule` is a subclass of Rule that defines how a required field is validated.
|
||||||
*/
|
*/
|
||||||
open class RequiredRule: Rule {
|
public class RequiredRule: Rule {
|
||||||
/// String that holds error message.
|
/// String that holds error message.
|
||||||
private var message : String
|
private var message : String
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ open class RequiredRule: Rule {
|
||||||
- parameter value: String to checked for validation.
|
- parameter value: String to checked for validation.
|
||||||
- returns: Boolean value. True if validation is successful; False if validation fails.
|
- returns: Boolean value. True if validation is successful; False if validation fails.
|
||||||
*/
|
*/
|
||||||
open func validate(_ value: String) -> Bool {
|
public func validate(_ value: String) -> Bool {
|
||||||
return !value.isEmpty
|
return !value.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ open class RequiredRule: Rule {
|
||||||
|
|
||||||
- returns: String of error message.
|
- returns: String of error message.
|
||||||
*/
|
*/
|
||||||
open func errorMessage() -> String {
|
public func errorMessage() -> String {
|
||||||
return message
|
return message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -366,7 +366,7 @@ class SwiftValidatorTests: XCTestCase {
|
||||||
}
|
}
|
||||||
REGISTER_TXT_FIELD.text = INVALID_EMAIL
|
REGISTER_TXT_FIELD.text = INVALID_EMAIL
|
||||||
REGISTER_VALIDATOR.validateField(REGISTER_TXT_FIELD) { error in
|
REGISTER_VALIDATOR.validateField(REGISTER_TXT_FIELD) { error in
|
||||||
XCTAssert(error?.errorMessage.count ?? 0 > 0, "Should state 'invalid email'")
|
XCTAssert(error?.errorMessage.characters.count ?? 0 > 0, "Should state 'invalid email'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,7 @@
|
||||||
attributes = {
|
attributes = {
|
||||||
LastSwiftMigration = 0700;
|
LastSwiftMigration = 0700;
|
||||||
LastSwiftUpdateCheck = 0700;
|
LastSwiftUpdateCheck = 0700;
|
||||||
LastUpgradeCheck = 0930;
|
LastUpgradeCheck = 0800;
|
||||||
ORGANIZATIONNAME = jpotts18;
|
ORGANIZATIONNAME = jpotts18;
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
62D1AE161A1E6D4400E4DFF8 = {
|
62D1AE161A1E6D4400E4DFF8 = {
|
||||||
|
|
@ -410,11 +410,11 @@
|
||||||
};
|
};
|
||||||
FB465CB21B9884F400398388 = {
|
FB465CB21B9884F400398388 = {
|
||||||
CreatedOnToolsVersion = 6.4;
|
CreatedOnToolsVersion = 6.4;
|
||||||
LastSwiftMigration = 1010;
|
LastSwiftMigration = 0800;
|
||||||
};
|
};
|
||||||
FB465CBC1B9884F400398388 = {
|
FB465CBC1B9884F400398388 = {
|
||||||
CreatedOnToolsVersion = 6.4;
|
CreatedOnToolsVersion = 6.4;
|
||||||
LastSwiftMigration = 1010;
|
LastSwiftMigration = 0800;
|
||||||
TestTargetID = 62D1AE161A1E6D4400E4DFF8;
|
TestTargetID = 62D1AE161A1E6D4400E4DFF8;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -584,22 +584,14 @@
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
CLANG_WARN_COMMA = YES;
|
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
||||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
CLANG_WARN_INT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
|
@ -627,7 +619,6 @@
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 4.0;
|
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
|
@ -639,22 +630,14 @@
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
CLANG_WARN_COMMA = YES;
|
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
||||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
CLANG_WARN_INT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
|
@ -673,8 +656,6 @@
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
|
||||||
SWIFT_VERSION = 4.0;
|
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
|
@ -687,7 +668,7 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)";
|
PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 4.2;
|
SWIFT_VERSION = 3.0;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
|
@ -700,7 +681,7 @@
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)";
|
PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
SWIFT_VERSION = 4.2;
|
SWIFT_VERSION = 3.0;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|
@ -716,7 +697,7 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)";
|
PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 4.1;
|
SWIFT_VERSION = 3.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator";
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
|
|
@ -729,7 +710,7 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)";
|
PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 4.1;
|
SWIFT_VERSION = 3.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator";
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
|
@ -737,7 +718,6 @@
|
||||||
FB465CCC1B9884F400398388 /* Debug */ = {
|
FB465CCC1B9884F400398388 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_IDENTITY = "";
|
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
|
|
@ -755,7 +735,7 @@
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)";
|
PRODUCT_BUNDLE_IDENTIFIER = "me.jeffpotter.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
SWIFT_VERSION = 4.2;
|
SWIFT_VERSION = 3.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
VERSION_INFO_PREFIX = "";
|
VERSION_INFO_PREFIX = "";
|
||||||
|
|
@ -765,7 +745,6 @@
|
||||||
FB465CCD1B9884F400398388 /* Release */ = {
|
FB465CCD1B9884F400398388 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_IDENTITY = "";
|
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
|
@ -781,7 +760,7 @@
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
SWIFT_VERSION = 4.2;
|
SWIFT_VERSION = 3.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
VERSION_INFO_PREFIX = "";
|
VERSION_INFO_PREFIX = "";
|
||||||
|
|
@ -806,7 +785,7 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.levous.$(PRODUCT_NAME:rfc1034identifier)";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.levous.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 4.2;
|
SWIFT_VERSION = 3.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator";
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
|
|
@ -827,7 +806,7 @@
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.levous.$(PRODUCT_NAME:rfc1034identifier)";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.levous.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
SWIFT_VERSION = 4.2;
|
SWIFT_VERSION = 3.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator";
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>IDEDidComputeMac32BitWarning</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0930"
|
LastUpgradeVersion = "0800"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0930"
|
LastUpgradeVersion = "0800"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|
@ -26,8 +26,8 @@
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
codeCoverageEnabled = "YES"
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
codeCoverageEnabled = "YES">
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0930"
|
LastUpgradeVersion = "0800"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
|
||||||
|
|
||||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||||
// Override point for customization after application launch.
|
// Override point for customization after application launch.
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ class ViewController: UIViewController , ValidationDelegate, UITextFieldDelegate
|
||||||
|
|
||||||
func validationSuccessful() {
|
func validationSuccessful() {
|
||||||
print("Validation Success!")
|
print("Validation Success!")
|
||||||
let alert = UIAlertController(title: "Success", message: "You are validated!", preferredStyle: UIAlertController.Style.alert)
|
let alert = UIAlertController(title: "Success", message: "You are validated!", preferredStyle: UIAlertControllerStyle.alert)
|
||||||
let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil)
|
let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil)
|
||||||
alert.addAction(defaultAction)
|
alert.addAction(defaultAction)
|
||||||
self.present(alert, animated: true, completion: nil)
|
self.present(alert, animated: true, completion: nil)
|
||||||
|
|
@ -79,7 +79,7 @@ class ViewController: UIViewController , ValidationDelegate, UITextFieldDelegate
|
||||||
print("Validation FAILED!")
|
print("Validation FAILED!")
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func hideKeyboard(){
|
func hideKeyboard(){
|
||||||
self.view.endEditing(true)
|
self.view.endEditing(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue