reorientation
This commit is contained in:
parent
c913b98aa5
commit
e6c0145efa
@ -69,11 +69,7 @@ import UIKit
|
|||||||
get { return entryFieldContainer.showError }
|
get { return entryFieldContainer.showError }
|
||||||
set (error) {
|
set (error) {
|
||||||
self.feedback = error ? entryFieldModel?.errorMessage : entryFieldModel?.feedback
|
self.feedback = error ? entryFieldModel?.errorMessage : entryFieldModel?.feedback
|
||||||
if error {
|
self.feedbackLabel.textColor = error ? entryFieldModel?.errorTextColor?.uiColor ?? .mvmBlack : .mvmBlack
|
||||||
feedbackLabel.textColor = entryFieldModel?.errorTextColor?.uiColor ?? .mvmBlack
|
|
||||||
} else {
|
|
||||||
feedbackLabel.textColor = .mvmBlack
|
|
||||||
}
|
|
||||||
self.entryFieldContainer.showError = error
|
self.entryFieldContainer.showError = error
|
||||||
self.entryFieldModel?.showError = error
|
self.entryFieldModel?.showError = error
|
||||||
}
|
}
|
||||||
|
|||||||
@ -222,7 +222,6 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
|
|
||||||
@objc public func textViewDidBeginEditing(_ textView: UITextView) {
|
@objc public func textViewDidBeginEditing(_ textView: UITextView) {
|
||||||
|
|
||||||
self.textView.setTextAppearance()
|
|
||||||
isSelected = true
|
isSelected = true
|
||||||
proprietorTextDelegate?.textViewDidBeginEditing?(textView)
|
proprietorTextDelegate?.textViewDidBeginEditing?(textView)
|
||||||
}
|
}
|
||||||
@ -244,8 +243,7 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc public func textViewDidEndEditing(_ textView: UITextView) {
|
@objc public func textViewDidEndEditing(_ textView: UITextView) {
|
||||||
|
|
||||||
self.textView.setPlaceholderIfAvailable()
|
|
||||||
isSelected = false
|
isSelected = false
|
||||||
|
|
||||||
if isValid {
|
if isValid {
|
||||||
|
|||||||
@ -31,7 +31,6 @@ class TextViewEntryFieldModel: TextEntryFieldModel {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case text
|
|
||||||
case accessibilityText
|
case accessibilityText
|
||||||
case fontStyle
|
case fontStyle
|
||||||
case height
|
case height
|
||||||
@ -60,6 +59,10 @@ class TextViewEntryFieldModel: TextEntryFieldModel {
|
|||||||
self.fontStyle = fontStyle
|
self.fontStyle = fontStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let editable = try typeContainer.decodeIfPresent(Bool.self, forKey: .editable) {
|
||||||
|
self.editable = editable
|
||||||
|
}
|
||||||
|
|
||||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height)
|
height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height)
|
||||||
}
|
}
|
||||||
@ -70,7 +73,7 @@ class TextViewEntryFieldModel: TextEntryFieldModel {
|
|||||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||||
try container.encodeIfPresent(height, forKey: .height)
|
try container.encodeIfPresent(height, forKey: .height)
|
||||||
try container.encode(fontStyle, forKey: .fontStyle)
|
try container.encode(fontStyle, forKey: .fontStyle)
|
||||||
try container.encode(text, forKey: .text)
|
try container.encode(editable, forKey: .editable)
|
||||||
try container.encode(placeholderFontStyle, forKey: .placeholderFontStyle)
|
try container.encode(placeholderFontStyle, forKey: .placeholderFontStyle)
|
||||||
try container.encode(placeholderTextColor, forKey: .placeholderTextColor)
|
try container.encode(placeholderTextColor, forKey: .placeholderTextColor)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,7 +119,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Methods
|
// MARK: - TextInputDidDeleteProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
/// Alters the blinking caret line as per design standards.
|
/// Alters the blinking caret line as per design standards.
|
||||||
@ -138,11 +138,22 @@ import UIKit
|
|||||||
didDeleteDelegate?.textInputDidDelete()
|
didDeleteDelegate?.textInputDidDelete()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setTextAppearance() {
|
//--------------------------------------------------
|
||||||
|
// MARK: - Text / Placeholder
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
open override func becomeFirstResponder() -> Bool {
|
||||||
|
|
||||||
if isShowingPlaceholder {
|
if isShowingPlaceholder {
|
||||||
setTextContentTraits()
|
setTextContentTraits()
|
||||||
}
|
}
|
||||||
|
return super.becomeFirstResponder()
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func resignFirstResponder() -> Bool {
|
||||||
|
|
||||||
|
setPlaceholderIfAvailable()
|
||||||
|
return super.resignFirstResponder()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setPlaceholderIfAvailable() {
|
public func setPlaceholderIfAvailable() {
|
||||||
@ -152,7 +163,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setTextContentTraits() {
|
open func setTextContentTraits() {
|
||||||
|
|
||||||
isShowingPlaceholder = false
|
isShowingPlaceholder = false
|
||||||
text = ""
|
text = ""
|
||||||
@ -160,7 +171,7 @@ import UIKit
|
|||||||
textColor = .mvmBlack
|
textColor = .mvmBlack
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setPlaceholderContentTraits() {
|
open func setPlaceholderContentTraits() {
|
||||||
|
|
||||||
isShowingPlaceholder = true
|
isShowingPlaceholder = true
|
||||||
textColor = placeholderTextColor
|
textColor = placeholderTextColor
|
||||||
@ -168,8 +179,8 @@ import UIKit
|
|||||||
text = placeholder
|
text = placeholder
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func dismissFieldInput(_ sender: TextView) {
|
@objc open func dismissFieldInput(_ sender: TextView) {
|
||||||
|
|
||||||
resignFirstResponder()
|
_ = resignFirstResponder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user