diff --git a/DPOTPView/DPOTPView.xcodeproj/project.pbxproj b/DPOTPView/DPOTPView.xcodeproj/project.pbxproj index 4efbcc9..c995ec4 100644 --- a/DPOTPView/DPOTPView.xcodeproj/project.pbxproj +++ b/DPOTPView/DPOTPView.xcodeproj/project.pbxproj @@ -186,7 +186,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1120; - LastUpgradeCheck = 1120; + LastUpgradeCheck = 1140; ORGANIZATIONNAME = datt; TargetAttributes = { C6604BEA247B2037005F402D = { @@ -289,7 +289,7 @@ C6604BF5247B2037005F402D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -321,7 +321,7 @@ C6604BF6247B2037005F402D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -471,13 +471,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = 3Y587YMRM5; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = DPOTPView/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); + MARKETING_VERSION = 1; PRODUCT_BUNDLE_IDENTIFIER = "com.datt.DPOTPView-example"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -493,13 +494,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = 3Y587YMRM5; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = DPOTPView/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); + MARKETING_VERSION = 1; PRODUCT_BUNDLE_IDENTIFIER = "com.datt.DPOTPView-example"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/DPOTPView/DPOTPView.xcodeproj/project.xcworkspace/xcuserdata/datt.xcuserdatad/UserInterfaceState.xcuserstate b/DPOTPView/DPOTPView.xcodeproj/project.xcworkspace/xcuserdata/datt.xcuserdatad/UserInterfaceState.xcuserstate index 6685be4..3f8146b 100644 Binary files a/DPOTPView/DPOTPView.xcodeproj/project.xcworkspace/xcuserdata/datt.xcuserdatad/UserInterfaceState.xcuserstate and b/DPOTPView/DPOTPView.xcodeproj/project.xcworkspace/xcuserdata/datt.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/DPOTPView/DPOTPView/Base.lproj/Main.storyboard b/DPOTPView/DPOTPView/Base.lproj/Main.storyboard index d95ef9e..fb29717 100644 --- a/DPOTPView/DPOTPView/Base.lproj/Main.storyboard +++ b/DPOTPView/DPOTPView/Base.lproj/Main.storyboard @@ -90,6 +90,9 @@ + + + diff --git a/DPOTPView/DPOTPView/DPOTPView/DPOTPView.swift b/DPOTPView/DPOTPView/DPOTPView/DPOTPView.swift index 7fb780f..e8908d8 100644 --- a/DPOTPView/DPOTPView/DPOTPView/DPOTPView.swift +++ b/DPOTPView/DPOTPView/DPOTPView/DPOTPView.swift @@ -45,6 +45,9 @@ public protocol DPOTPViewDelegate { /** Background color for the textField */ @IBInspectable open dynamic var backGroundColorTextField: UIColor = UIColor.clear + /** Background color for the filled textField */ + @IBInspectable open dynamic var backGroundColorFilledTextField: UIColor? + /** Border color for the TextField */ @IBInspectable open dynamic var borderColorTextField: UIColor? @@ -146,7 +149,7 @@ public protocol DPOTPViewDelegate { textField.borderStyle = .none textField.tag = i * 1000 textField.tintColor = tintColorTextField - textField.layer.backgroundColor = backGroundColorTextField.cgColor + textField.backgroundColor = backGroundColorTextField textField.isSecureTextEntry = isSecureTextEntry textField.font = fontTextField textField.keyboardAppearance = isDarkKeyboard ? .dark : .default @@ -285,10 +288,19 @@ protocol OTPBackTextFieldDelegate { } -class OTPBackTextField: UITextField { +fileprivate class OTPBackTextField: UITextField { var OTPBackDelegate : OTPBackTextFieldDelegate? weak var dpOTPView : DPOTPView! + override var text: String? { + didSet { + if text?.isEmpty ?? true { + self.backgroundColor = dpOTPView.backGroundColorTextField + } else { + self.backgroundColor = dpOTPView.backGroundColorFilledTextField ?? dpOTPView.backGroundColorTextField + } + } + } override func deleteBackward() { super.deleteBackward() @@ -383,7 +395,7 @@ class OTPBackTextField: UITextField { } -extension String { +fileprivate extension String { subscript(_ i: Int) -> String { let idx1 = index(startIndex, offsetBy: i) let idx2 = index(idx1, offsetBy: 1)