From 5672b1803e0087a64b4de81d30a29d18101e9a62 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 22 May 2019 18:50:25 +0900 Subject: [PATCH] change ValidateTextField as CocoaPods's ValidateTextField --- GME Remit.xcodeproj/project.pbxproj | 18 +- .../ValidationTextField.swift | 386 - GMERemittance/Module/.DS_Store | Bin 8196 -> 8196 bytes .../User Interface/View/AddAccount.storyboard | 19 +- .../View/AddAccountViewController.swift | 10 +- Podfile | 1 + Podfile.lock | 6 +- Pods/Manifest.lock | 6 +- Pods/Pods.xcodeproj/project.pbxproj | 9613 +++++++++-------- .../Pods-GME Remit-acknowledgements.markdown | 226 + .../Pods-GME Remit-acknowledgements.plist | 232 + .../Pods-GME Remit-frameworks.sh | 2 + .../Pods-GME Remit.debug.xcconfig | 6 +- .../Pods-GME Remit.release.xcconfig | 6 +- ...ERemittanceTests-acknowledgements.markdown | 226 + ...-GMERemittanceTests-acknowledgements.plist | 232 + .../Pods-GMERemittanceTests-frameworks.sh | 2 + .../Pods-GMERemittanceTests.debug.xcconfig | 6 +- .../Pods-GMERemittanceTests.release.xcconfig | 6 +- ...emittanceUITests-acknowledgements.markdown | 226 + ...MERemittanceUITests-acknowledgements.plist | 232 + .../Pods-GMERemittanceUITests-frameworks.sh | 2 + .../Pods-GMERemittanceUITests.debug.xcconfig | 6 +- ...Pods-GMERemittanceUITests.release.xcconfig | 6 +- .../ValidationTextField-Info.plist | 26 + .../ValidationTextField-dummy.m | 5 + .../ValidationTextField-prefix.pch | 12 + .../ValidationTextField-umbrella.h | 16 + .../ValidationTextField.modulemap | 6 + .../ValidationTextField.xcconfig | 9 + Pods/ValidationTextField/LICENSE | 222 + Pods/ValidationTextField/README.md | 55 + .../ValidationTextField/Assets/error.png | Bin 0 -> 1559 bytes .../ValidationTextField/Assets/success.png | Bin 0 -> 1586 bytes .../Classes/ValidationTextField.swift | 446 + 35 files changed, 7143 insertions(+), 5129 deletions(-) delete mode 100644 GMERemittance/Library/ValidationTextField/ValidationTextField.swift create mode 100644 Pods/Target Support Files/ValidationTextField/ValidationTextField-Info.plist create mode 100644 Pods/Target Support Files/ValidationTextField/ValidationTextField-dummy.m create mode 100644 Pods/Target Support Files/ValidationTextField/ValidationTextField-prefix.pch create mode 100644 Pods/Target Support Files/ValidationTextField/ValidationTextField-umbrella.h create mode 100644 Pods/Target Support Files/ValidationTextField/ValidationTextField.modulemap create mode 100644 Pods/Target Support Files/ValidationTextField/ValidationTextField.xcconfig create mode 100644 Pods/ValidationTextField/LICENSE create mode 100644 Pods/ValidationTextField/README.md create mode 100644 Pods/ValidationTextField/ValidationTextField/Assets/error.png create mode 100644 Pods/ValidationTextField/ValidationTextField/Assets/success.png create mode 100644 Pods/ValidationTextField/ValidationTextField/Classes/ValidationTextField.swift diff --git a/GME Remit.xcodeproj/project.pbxproj b/GME Remit.xcodeproj/project.pbxproj index d4db5463..e43b965d 100644 --- a/GME Remit.xcodeproj/project.pbxproj +++ b/GME Remit.xcodeproj/project.pbxproj @@ -381,7 +381,6 @@ A2FD3AED2052566A00404EA9 /* NotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2FD3AEC2052566A00404EA9 /* NotificationModel.swift */; }; A2FD3AEF2052568900404EA9 /* NotificationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2FD3AEE2052568900404EA9 /* NotificationViewModel.swift */; }; BE4B1C97227C926700E923E8 /* NSError+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE4B1C96227C926700E923E8 /* NSError+Ext.swift */; }; - BE657159227C90C5000E0DF1 /* ValidationTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE657158227C90C5000E0DF1 /* ValidationTextField.swift */; }; BE74AFBA227C8FF200F05CE7 /* AddAccountModuleInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE74AF91227C8FF100F05CE7 /* AddAccountModuleInterface.swift */; }; BE74AFBB227C8FF200F05CE7 /* KFTCBankList.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE74AF94227C8FF100F05CE7 /* KFTCBankList.swift */; }; BE74AFBC227C8FF200F05CE7 /* AddAccountService.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE74AF96227C8FF100F05CE7 /* AddAccountService.swift */; }; @@ -2676,7 +2675,6 @@ B645CB5C66870B30AC5720DD /* Pods-GMERemittanceUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GMERemittanceUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-GMERemittanceUITests/Pods-GMERemittanceUITests.release.xcconfig"; sourceTree = ""; }; B7F20D7B2ABA65B2B56F1DD1 /* Pods-GME Remit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GME Remit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GME Remit/Pods-GME Remit.debug.xcconfig"; sourceTree = ""; }; BE4B1C96227C926700E923E8 /* NSError+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSError+Ext.swift"; sourceTree = ""; }; - BE657158227C90C5000E0DF1 /* ValidationTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidationTextField.swift; sourceTree = ""; }; BE74AF91227C8FF100F05CE7 /* AddAccountModuleInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddAccountModuleInterface.swift; sourceTree = ""; }; BE74AF94227C8FF100F05CE7 /* KFTCBankList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KFTCBankList.swift; sourceTree = ""; }; BE74AF96227C8FF100F05CE7 /* AddAccountService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddAccountService.swift; sourceTree = ""; }; @@ -6413,14 +6411,6 @@ path = Notification; sourceTree = ""; }; - BE657157227C90C5000E0DF1 /* ValidationTextField */ = { - isa = PBXGroup; - children = ( - BE657158227C90C5000E0DF1 /* ValidationTextField.swift */, - ); - path = ValidationTextField; - sourceTree = ""; - }; BE74AF8E227C8FF100F05CE7 /* AutoDebitModules */ = { isa = PBXGroup; children = ( @@ -10549,7 +10539,6 @@ isa = PBXGroup; children = ( 7312F6452281486200172BDD /* ConfirmAlert */, - BE657157227C90C5000E0DF1 /* ValidationTextField */, D9B39675214F7DDC0072A9B8 /* ImageCroper.swift */, D9B39676214F7DDC0072A9B8 /* MultiMediaManager.swift */, D95B7044213FB5F00053CC3D /* WebLinks */, @@ -13423,6 +13412,7 @@ "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework", "${BUILT_PRODUCTS_DIR}/SwiftyTimer/SwiftyTimer.framework", + "${BUILT_PRODUCTS_DIR}/ValidationTextField/ValidationTextField.framework", "${BUILT_PRODUCTS_DIR}/VisualEffectView/VisualEffectView.framework", "${BUILT_PRODUCTS_DIR}/XLPagerTabStrip/XLPagerTabStrip.framework", "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", @@ -13452,6 +13442,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyTimer.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ValidationTextField.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VisualEffectView.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/XLPagerTabStrip.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", @@ -13491,6 +13482,7 @@ "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework", "${BUILT_PRODUCTS_DIR}/SwiftyTimer/SwiftyTimer.framework", + "${BUILT_PRODUCTS_DIR}/ValidationTextField/ValidationTextField.framework", "${BUILT_PRODUCTS_DIR}/VisualEffectView/VisualEffectView.framework", "${BUILT_PRODUCTS_DIR}/XLPagerTabStrip/XLPagerTabStrip.framework", "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", @@ -13520,6 +13512,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyTimer.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ValidationTextField.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VisualEffectView.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/XLPagerTabStrip.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", @@ -13577,6 +13570,7 @@ "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework", "${BUILT_PRODUCTS_DIR}/SwiftyTimer/SwiftyTimer.framework", + "${BUILT_PRODUCTS_DIR}/ValidationTextField/ValidationTextField.framework", "${BUILT_PRODUCTS_DIR}/VisualEffectView/VisualEffectView.framework", "${BUILT_PRODUCTS_DIR}/XLPagerTabStrip/XLPagerTabStrip.framework", "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", @@ -13606,6 +13600,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyTimer.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ValidationTextField.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VisualEffectView.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/XLPagerTabStrip.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", @@ -13667,7 +13662,6 @@ 9F2E0D162059168C008611D1 /* LoadBalanceViewController.swift in Sources */, BEF000C7226757D600AB5663 /* SecureKeypad.swift in Sources */, D9DAFE27213530A800483E71 /* PaymentModeRecipientViewModel.swift in Sources */, - BE657159227C90C5000E0DF1 /* ValidationTextField.swift in Sources */, 731154CA227BF4CA00FEBF7F /* Redeem.swift in Sources */, 73BCCDD2228993040057B161 /* RewardGroupInteractor.swift in Sources */, D96A4FF62146625C00CFD507 /* RegisterModuleInterface.swift in Sources */, diff --git a/GMERemittance/Library/ValidationTextField/ValidationTextField.swift b/GMERemittance/Library/ValidationTextField/ValidationTextField.swift deleted file mode 100644 index a244426e..00000000 --- a/GMERemittance/Library/ValidationTextField/ValidationTextField.swift +++ /dev/null @@ -1,386 +0,0 @@ -// -// DevikTextField.swift -// GMETextFIeld -// -// Created by InKwon Devik Kim on 16/04/2019. -// Copyright © 2019 devikkim. All rights reserved. -// - -import UIKit - -@IBDesignable -open class ValidationTextField: UITextField { - - // MARK: Heights - - private var lineHeight: CGFloat = 0 - private var selectedLineHeight: CGFloat = 0 - - // MARK: IBInspectable - - @IBInspectable - open var completedTitleText: String = "Completed!" { - didSet { - update() - } - } - - @IBInspectable - open var completedTitleFont: UIFont = .systemFont(ofSize: 17) { - didSet{ - update() - createTitleLabel() - } - } - - @IBInspectable - open var completedColor: UIColor = UIColor(red:0.07, green:0.56, blue:0.33, alpha:1.0) { - didSet{ - update() - } - } - - @IBInspectable - open var baseColor: UIColor = .darkGray { - didSet{ - update() - } - } - - @IBInspectable - open var baseFont: UIFont = .systemFont(ofSize: 17) { - didSet{ - update() - createTitleLabel() - } - } - - @IBInspectable - open var errorColor: UIColor = UIColor(red:0.99, green:0.16, blue:0.11, alpha:1.0) { - didSet{ - update() - } - } - - @IBInspectable - open var errorFont: UIFont = .systemFont(ofSize: 17) { - didSet{ - update() - createTitleLabel() - } - } - - @IBInspectable - open var errorMessage: String? { - didSet{ - update() - } - } - - @IBInspectable - open var disabledColor: UIColor = UIColor(white: 0.88, alpha: 1.0) { - didSet { - update() - updatePlaceholder() - } - } - - @IBInspectable - open override var placeholder: String? { - didSet { - setNeedsDisplay() - update() - } - } - - @IBInspectable - open var placeholderColor: UIColor = UIColor.lightGray { - didSet { - updatePlaceholder() - } - } - - - // MARK: Properties - - open var validCondition: ((String) -> Bool)? - - open var isValid = false - - private var titleLabel: UILabel! - - private var lineView: UIView! - - private var _errorMessage: String? - - private var titleFadeInDuration: TimeInterval = 0.2 - - private var titleFadeOutDuration: TimeInterval = 0.3 - - private var placeholderFont: UIFont? { - didSet { - updatePlaceholder() - } - } - - private var hasErrorMessage: Bool{ - return self._errorMessage != nil && self._errorMessage != "" - } - - private var isTitleVisible: Bool { - return hasText || hasErrorMessage - } - - private var editingOrSelected: Bool { - return super.isEditing || isSelected - } - - // MARK: Initialize - - override init(frame: CGRect) { - super.init(frame: frame) - self.initValidationTextField() - } - - required public init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - self.initValidationTextField() - } - - private func initValidationTextField() { - borderStyle = .none - self.createTitleLabel() - self.createLineView() - self.addEditingChangedObserver() - } - - private func addEditingChangedObserver(){ - self.addTarget(self, action: #selector(self.editingChanged), for: [.editingChanged]) - } - - @objc - private func editingChanged() { - if let isValid = validCondition?(self.text ?? ""), !isValid { - self.isValid = isValid - _errorMessage = errorMessage - } else { - self.isValid = true - _errorMessage = nil - } - - update() - - self.updateTitleVisibility(true) - } - - private func createTitleLabel() { - let titleLabel = UILabel() - - titleLabel.autoresizingMask = [.flexibleWidth,. flexibleHeight] - titleLabel.font = completedTitleFont - titleLabel.alpha = 0.0 - titleLabel.textColor = completedColor - - addSubview(titleLabel) - self.titleLabel = titleLabel - } - - private func createLineView() { - if self.lineView == nil { - let lineView = UIView() - lineView.isUserInteractionEnabled = false - self.lineView = lineView - self.lineView.backgroundColor = baseColor - self.configureDefaultLineHeight() - } - - lineView.autoresizingMask = [.flexibleWidth, .flexibleTopMargin] - addSubview(lineView) - } - - private func titleHeight() -> CGFloat { - if let titleLabel = titleLabel, - let font = titleLabel.font { - return font.lineHeight - } - return 15.0 - } - - private func configureDefaultLineHeight() { - let pixel: CGFloat = 1.0 / UIScreen.main.scale - self.lineHeight = 2.0 * pixel - self.selectedLineHeight = 2.0 * self.lineHeight - } - - private func titleLabelRectForBounds(_ bounds: CGRect, editing: Bool) -> CGRect { - if editing { - return CGRect( - x: 0, - y: 0, - width: bounds.size.width, - height: titleHeight() - ) - } else { - return CGRect( - x: 0, - y: titleHeight(), - width: bounds.size.width, - height: titleHeight() - ) - } - } - - private func lineViewRectForBounds(_ bounds: CGRect, editing: Bool) -> CGRect { - let height = editing ? selectedLineHeight : lineHeight - - return CGRect( - x: 0, - y: bounds.size.height - height, - width: bounds.size.width, - height: height - ) - } - - private func textHeight() -> CGFloat { - guard let font = self.font else { return 0.0 } - - return font.lineHeight + 7.0 - } - - private func updateTitleVisibility(_ animated: Bool = false) { - let alpha: CGFloat = self.isTitleVisible ? 1.0 : 0.0 - let frame = titleLabelRectForBounds(bounds, editing: isTitleVisible) - - let updateBlock = {() -> Void in - self.titleLabel.alpha = alpha - self.titleLabel.frame = frame - } - - if animated { - #if swift(>=4.2) - let animationOptions: UIView.AnimationOptions = .curveEaseOut - #else - let animationOptions: UIViewAnimationOptions = .curveEaseOut - #endif - - let duration = isTitleVisible ? titleFadeInDuration : titleFadeOutDuration - - UIView.animate(withDuration: duration, delay: 0, options: animationOptions, animations: { () -> Void in - updateBlock() - }, completion: nil) - } else { - - } - } - - private func update(){ - if hasErrorMessage{ - titleLabel.text = errorMessage - titleLabel.textColor = errorColor - titleLabel.font = errorFont - lineView.backgroundColor = errorColor - } else if editingOrSelected || self.text ?? "" != "" { - titleLabel.text = completedTitleText - titleLabel.textColor = completedColor - titleLabel.font = completedTitleFont - lineView.backgroundColor = completedColor - } else { - titleLabel.text = completedTitleText - titleLabel.textColor = completedColor - titleLabel.font = baseFont - lineView.backgroundColor = baseColor - } - - updateTitleVisibility(true) - } - - private func updatePlaceholder() { - guard let placeholder = placeholder, let font = placeholderFont ?? font else { - return - } - let color = isEnabled ? placeholderColor : disabledColor - #if swift(>=4.2) - attributedPlaceholder = NSAttributedString( - string: placeholder, - attributes: [ - NSAttributedString.Key.foregroundColor: color, NSAttributedString.Key.font: font - ] - ) - #elseif swift(>=4.0) - attributedPlaceholder = NSAttributedString( - string: placeholder, - attributes: [ - NSAttributedStringKey.foregroundColor: color, NSAttributedStringKey.font: font - ] - ) - #else - attributedPlaceholder = NSAttributedString( - string: placeholder, - attributes: [NSForegroundColorAttributeName: color, NSFontAttributeName: font] - ) - #endif - } - - override open func textRect(forBounds bounds: CGRect) -> CGRect { - let superRect = super.textRect(forBounds: bounds) - let titleHeight = self.titleHeight() - - return CGRect( - x: superRect.origin.x, - y: titleHeight, - width: superRect.size.width, - height: superRect.size.height - titleHeight - selectedLineHeight - ) - } - - override open func editingRect(forBounds bounds: CGRect) -> CGRect { - let superRect = super.editingRect(forBounds: bounds) - let titleHeight = self.titleHeight() - - return CGRect( - x: superRect.origin.x, - y: titleHeight, - width: superRect.size.width, - height: superRect.size.height - titleHeight - selectedLineHeight - ) - } - - override open func placeholderRect(forBounds bounds: CGRect) -> CGRect { - let rect = CGRect( - x: 0, - y: titleHeight(), - width: bounds.size.width, - height: bounds.size.height - titleHeight() - selectedLineHeight - ) - return rect - } - - override open func prepareForInterfaceBuilder() { - if #available(iOS 8.0, *) { - super.prepareForInterfaceBuilder() - } - - borderStyle = .none - - isSelected = true - invalidateIntrinsicContentSize() - } - - override open func layoutSubviews() { - super.layoutSubviews() - - titleLabel.frame = self.titleLabelRectForBounds( - bounds, - editing: self.isTitleVisible - ) - - lineView.frame = self.lineViewRectForBounds( - bounds, - editing: self.editingOrSelected - ) - } - - override open var intrinsicContentSize: CGSize { - return CGSize(width: bounds.size.width, height: titleHeight() + textHeight()) - } -} diff --git a/GMERemittance/Module/.DS_Store b/GMERemittance/Module/.DS_Store index 5672d8b370e5a1e27e95b53861c951519dbc17b6..a60d8e80588947cbb0d237a1b48b4f46c15f2033 100644 GIT binary patch delta 269 zcmZp1XmOa}&nU1lU^hRbz+@f)+gJexM}|^{5{7&R7lu@ZB!)~N+ZV`70gC1TMT(Qk ziwlx+@{<@C7)~Y?*q7+G4@>L^s3n;YmTm>8SY)^c))s~XyRCgfID zRoB$k%>-Hm1dNOjnt>lm!>Cz620=%c1sCPzozjQ{`u delta 41 xcmZp1XmOa}&&aniU^hP_-((&E+s#FSQ`t5)XfkeQm-xoASxxLA - + - - + + @@ -48,10 +48,11 @@ + - - + + @@ -59,10 +60,11 @@ + - - + + @@ -70,6 +72,7 @@ + @@ -83,7 +86,7 @@