Compare commits

...

6 Commits

Author SHA1 Message Date
Alexey Gerasimov db272a717a
Merge pull request #1 from TouchInstinct/feature/newVersion
Podspec fixed
2018-12-03 12:26:46 +03:00
scoreyou 8e0168b270 Version changed 2018-12-03 12:26:05 +03:00
scoreyou f94de389e4 Podspec fixed 2018-12-03 11:51:09 +03:00
scoreyou 0190013526 Moved to swift 4.2 2018-11-30 16:46:41 +03:00
Rajat jain c0ee801a2d
Merge pull request #190 from johannespfeiffer/patch-1
Update README.md
2018-08-10 23:48:27 +05:30
Johannes Pfeiffer 0debc5d7eb Update README.md
Updated installation snippet to swift 4
2017-09-29 19:06:44 +02:00
6 changed files with 24 additions and 24 deletions

View File

@ -107,16 +107,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.redColor().CGColor field.layer.borderColor = UIColor.red.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?.hidden = false error.errorLabel?.isHidden = false
} }
} }
``` ```

View File

@ -1,15 +1,15 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "SwiftValidator" s.name = "SwiftValidator"
s.version = "4.0.0" s.version = "4.0.2"
s.summary = "A UITextField Validation library for Swift" s.summary = "A UITextField Validation library for Swift"
s.homepage = "https://github.com/jpotts18/SwiftValidator" s.homepage = "https://github.com/TouchInstinct/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 = '8.0'
s.source = { :git => "https://github.com/jpotts18/SwiftValidator.git", :tag => "4.0.0" } s.source = { :git => "https://github.com/TouchInstinct/SwiftValidator.git", :tag => s.version }
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']

View File

@ -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.characters.count ?? 0 > 0, "Should state 'invalid email'") XCTAssert(error?.errorMessage.count ?? 0 > 0, "Should state 'invalid email'")
} }
} }

View File

@ -410,11 +410,11 @@
}; };
FB465CB21B9884F400398388 = { FB465CB21B9884F400398388 = {
CreatedOnToolsVersion = 6.4; CreatedOnToolsVersion = 6.4;
LastSwiftMigration = 0800; LastSwiftMigration = 1010;
}; };
FB465CBC1B9884F400398388 = { FB465CBC1B9884F400398388 = {
CreatedOnToolsVersion = 6.4; CreatedOnToolsVersion = 6.4;
LastSwiftMigration = 0800; LastSwiftMigration = 1010;
TestTargetID = 62D1AE161A1E6D4400E4DFF8; TestTargetID = 62D1AE161A1E6D4400E4DFF8;
}; };
}; };
@ -687,7 +687,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.0; SWIFT_VERSION = 4.2;
}; };
name = Debug; name = Debug;
}; };
@ -700,7 +700,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.0; SWIFT_VERSION = 4.2;
}; };
name = Release; name = Release;
}; };
@ -755,7 +755,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.0; SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = ""; VERSION_INFO_PREFIX = "";
@ -781,7 +781,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.0; SWIFT_VERSION = 4.2;
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 +806,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.0; SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator";
}; };
name = Debug; name = Debug;
@ -827,7 +827,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.0; SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Validator.app/Validator";
}; };
name = Release; name = Release;

View File

@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow? var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch. // Override point for customization after application launch.
return true return true
} }

View File

@ -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: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Success", message: "You are validated!", preferredStyle: UIAlertController.Style.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)