From 0ae010134673e38caba9dc03cb747eb74aac94a8 Mon Sep 17 00:00:00 2001 From: Alex Young Date: Fri, 17 Jul 2020 12:25:55 -0400 Subject: [PATCH] wip --- PinCodeTextField.xcodeproj/project.pbxproj | 3 +++ Pod/PinCodeTextField.swift | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/PinCodeTextField.xcodeproj/project.pbxproj b/PinCodeTextField.xcodeproj/project.pbxproj index 50c0350..79e8ce7 100644 --- a/PinCodeTextField.xcodeproj/project.pbxproj +++ b/PinCodeTextField.xcodeproj/project.pbxproj @@ -190,6 +190,7 @@ }; B5F084111E7996A70058D4A2 = { CreatedOnToolsVersion = 8.2; + DevelopmentTeam = 75S3NRR275; LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; @@ -453,6 +454,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 75S3NRR275; INFOPLIST_FILE = PinCodeTextFieldExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = organization.PinCodeTextField; @@ -465,6 +467,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 75S3NRR275; INFOPLIST_FILE = PinCodeTextFieldExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = organization.PinCodeTextField; diff --git a/Pod/PinCodeTextField.swift b/Pod/PinCodeTextField.swift index 06b2438..689b161 100644 --- a/Pod/PinCodeTextField.swift +++ b/Pod/PinCodeTextField.swift @@ -40,6 +40,7 @@ import UIKit @IBInspectable public var placeholderColor: UIColor = UIColor.lightGray @IBInspectable public var underlineColor: UIColor = UIColor.darkGray @IBInspectable public var updatedUnderlineColor: UIColor = UIColor.clear + @IBInspectable public var inputUnderlineColor: UIColor = UIColor.lightGray @IBInspectable public var secureText: Bool = false @IBInspectable public var needToUpdateUnderlines: Bool = true @IBInspectable public var characterBackgroundColor: UIColor = UIColor.clear @@ -208,12 +209,12 @@ import UIKit } private func updateUnderlines() { - for label in labels { - let index = labels.firstIndex(of: label) ?? 0 - if (!highlightInputUnderline || !isInput(index)) && isPlaceholder(index) { - underlines[index].backgroundColor = underlineColor - } - else{ + labels.enumerated().forEach { (index, label) in + if (highlightInputUnderline && isInput(index)) { + underlines[index].backgroundColor = inputUnderlineColor + } else if isPlaceholder(index) { + underlines[index].backgroundColor = underlineColor + } else{ underlines[index].backgroundColor = updatedUnderlineColor } }