moved code to parent

This commit is contained in:
Kevin G Christiano 2020-05-15 13:56:57 -04:00
parent ad4dfcf748
commit 6a9957d348
4 changed files with 16 additions and 11 deletions

View File

@ -322,7 +322,7 @@ import UIKit
@objc override open func resignFirstResponder() -> Bool { @objc override open func resignFirstResponder() -> Bool {
if validateWhenDoneEditing { if validateWhenDoneEditing {
validateTextField() validateText()
} }
selectedDigitBox?.isSelected = false selectedDigitBox?.isSelected = false
@ -440,7 +440,7 @@ extension DigitEntryField {
selectedDigitBox = nil selectedDigitBox = nil
if !switchFieldsAutomatically && validateWhenDoneEditing { if !switchFieldsAutomatically && validateWhenDoneEditing {
validateTextField() validateText()
} }
proprietorTextDelegate?.textFieldDidEndEditing?(textField) proprietorTextDelegate?.textFieldDidEndEditing?(textField)

View File

@ -236,6 +236,13 @@ import UIKit
// MARK: - Validation // MARK: - Validation
//-------------------------------------------------- //--------------------------------------------------
/// Validates the text of the entry field.
@objc public func validateText() {
if let isValid = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) {
self.isValid = isValid
}
}
/// Executes on .textDidBeginEditingNotification /// Executes on .textDidBeginEditingNotification
@objc func startEditing() { @objc func startEditing() {
isSelected = true isSelected = true

View File

@ -223,7 +223,7 @@ import UIKit
@discardableResult @discardableResult
@objc override open func resignFirstResponder() -> Bool { @objc override open func resignFirstResponder() -> Bool {
if validateWhenDoneEditing { if validateWhenDoneEditing {
validateTextField() validateText()
} }
textField.resignFirstResponder() textField.resignFirstResponder()
isSelected = false isSelected = false
@ -231,9 +231,9 @@ import UIKit
} }
/// Validates the text of the entry field. /// Validates the text of the entry field.
@objc public func validateTextField() { @objc public override func validateText() {
text = textField.text text = textField.text
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) super.validateText()
} }
@objc public func updateValidation(_ isValid: Bool) { @objc public func updateValidation(_ isValid: Bool) {
@ -266,7 +266,7 @@ import UIKit
/// Executes on UITextField.textDidChangeNotification (each character entry) /// Executes on UITextField.textDidChangeNotification (each character entry)
@objc override func valueChanged() { @objc override func valueChanged() {
super.valueChanged() super.valueChanged()
validateTextField() validateText()
} }
/// Executes on UITextField.textDidEndEditingNotification /// Executes on UITextField.textDidEndEditingNotification

View File

@ -183,11 +183,9 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
//-------------------------------------------------- //--------------------------------------------------
/// Validates the text of the entry field. /// Validates the text of the entry field.
@objc public func validateTextView() { @objc public override func validateText() {
text = textView.text text = textView.text
if let isValid = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) { super.validateText()
self.isValid = isValid
}
} }
/// Executes on UITextView.textDidBeginEditingNotification /// Executes on UITextView.textDidBeginEditingNotification
@ -199,7 +197,7 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
/// Executes on UITextView.textDidChangeNotification (each character entry) /// Executes on UITextView.textDidChangeNotification (each character entry)
@objc override func valueChanged() { @objc override func valueChanged() {
super.valueChanged() super.valueChanged()
validateTextView() validateText()
} }
/// Executes on UITextView.textDidEndEditingNotification /// Executes on UITextView.textDidEndEditingNotification