No Validate on Emoty

This commit is contained in:
Kevin G Christiano 2020-05-15 09:03:57 -04:00
parent c4fa9188b4
commit ac86d92574
2 changed files with 15 additions and 2 deletions

View File

@ -259,6 +259,7 @@ import UIKit
observingTextFieldDelegate?.isInvalid?(textfield: self)
}
}
/// Executes on UITextField.textDidBeginEditingNotification
@objc func startEditing() {
isSelected = true
@ -278,6 +279,7 @@ import UIKit
// Don't show error till user starts typing.
guard text?.count ?? 0 != 0 else {
showError = false
return
}

View File

@ -71,7 +71,7 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
/// The text of this textView.
open override var text: String? {
get { return textView.text }
get { return textViewEntryFieldModel?.text }
set {
textView.text = newValue
textViewEntryFieldModel?.text = newValue
@ -207,8 +207,19 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
/// Executes on UITextView.textDidEndEditingNotification
@objc func endInputing() {
resignFirstResponder()
isSelected = false
resignFirstResponder()
// Don't show error till user starts typing.
guard text?.count ?? 0 != 0 else {
showError = false
return
}
if let isValid = (model as? TextEntryFieldModel)?.isValid {
self.isValid = isValid
}
showError = !isValid
}