diff --git a/Example/KWVerificationCodeView.xcodeproj/project.pbxproj b/Example/KWVerificationCodeView.xcodeproj/project.pbxproj index 13407ac..77d2bb6 100644 --- a/Example/KWVerificationCodeView.xcodeproj/project.pbxproj +++ b/Example/KWVerificationCodeView.xcodeproj/project.pbxproj @@ -210,16 +210,16 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 1010; + LastSwiftMigration = 1020; }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 1010; + LastSwiftMigration = 1020; TestTargetID = 607FACCF1AFB9204008FA782; }; }; @@ -229,6 +229,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -270,7 +271,7 @@ files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-KWVerificationCodeView_Example/Pods-KWVerificationCodeView_Example-frameworks.sh", + "${PODS_ROOT}/Target Support Files/Pods-KWVerificationCodeView_Example/Pods-KWVerificationCodeView_Example-frameworks.sh", "${BUILT_PRODUCTS_DIR}/KWVerificationCodeView/KWVerificationCodeView.framework", ); name = "[CP] Embed Pods Frameworks"; @@ -279,7 +280,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-KWVerificationCodeView_Example/Pods-KWVerificationCodeView_Example-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-KWVerificationCodeView_Example/Pods-KWVerificationCodeView_Example-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; 8A96BB52F0E82B4C4B2EC0C9 /* [CP] Check Pods Manifest.lock */ = { @@ -373,6 +374,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -429,6 +431,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -487,7 +490,7 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "com.keepworks.KWVerificationCodeView-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -505,7 +508,7 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "com.keepworks.KWVerificationCodeView-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; name = Release; @@ -524,7 +527,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -538,7 +541,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Example/KWVerificationCodeView.xcodeproj/xcshareddata/xcschemes/KWVerificationCodeView-Example.xcscheme b/Example/KWVerificationCodeView.xcodeproj/xcshareddata/xcschemes/KWVerificationCodeView-Example.xcscheme index 5980668..df83ad3 100644 --- a/Example/KWVerificationCodeView.xcodeproj/xcshareddata/xcschemes/KWVerificationCodeView-Example.xcscheme +++ b/Example/KWVerificationCodeView.xcodeproj/xcshareddata/xcschemes/KWVerificationCodeView-Example.xcscheme @@ -1,6 +1,6 @@ String { var verificationCode = "" for textFieldView in textFieldViews { @@ -215,7 +219,7 @@ public protocol KWVerificationCodeViewDelegate: class { // MARK: - KWTextFieldDelegate extension KWVerificationCodeView: KWTextFieldDelegate { func moveToNext(_ textFieldView: KWTextFieldView) { - let validIndex = textFieldViews.index(of: textFieldView) == textFieldViews.count - 1 ? textFieldViews.index(of: textFieldView)! : textFieldViews.index(of: textFieldView)! + 1 + let validIndex = textFieldViews.firstIndex(of: textFieldView) == textFieldViews.count - 1 ? textFieldViews.firstIndex(of: textFieldView)! : textFieldViews.firstIndex(of: textFieldView)! + 1 textFieldViews[validIndex].activate() } @@ -225,7 +229,7 @@ extension KWVerificationCodeView: KWTextFieldDelegate { } if textFieldView.code == " " { - let validIndex = textFieldViews.index(of: textFieldView)! == 0 ? 0 : textFieldViews.index(of: textFieldView)! - 1 + let validIndex = textFieldViews.firstIndex(of: textFieldView)! == 0 ? 0 : textFieldViews.firstIndex(of: textFieldView)! - 1 textFieldViews[validIndex].activate() textFieldViews[validIndex].reset() } diff --git a/README.md b/README.md index c9f8002..0df5c4f 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,10 @@ Returns true when the entered code is valid. getVerificationCode() -> String +Focus on First Text Field + + focus() + Returns the validation code. clear()