aligning with android changes
This commit is contained in:
parent
d80b0731d2
commit
a685a8d9c4
@ -10,7 +10,6 @@ import Foundation
|
|||||||
|
|
||||||
|
|
||||||
@objcMembers open class EntryFieldModel: MoleculeModelProtocol, FormFieldProtocol, FormRuleWatcherFieldProtocol, EnableableModelProtocol {
|
@objcMembers open class EntryFieldModel: MoleculeModelProtocol, FormFieldProtocol, FormRuleWatcherFieldProtocol, EnableableModelProtocol {
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -227,7 +227,7 @@ extension TextView: MoleculeViewProtocol {
|
|||||||
layer.borderWidth = model.borderWidth
|
layer.borderWidth = model.borderWidth
|
||||||
text = model.text
|
text = model.text
|
||||||
uiTextViewDelegate = delegateObject?.uiTextViewDelegate
|
uiTextViewDelegate = delegateObject?.uiTextViewDelegate
|
||||||
isShowingPlaceholder = model.text.isEmpty
|
isShowingPlaceholder = model.text!.isEmpty
|
||||||
|
|
||||||
if let accessibilityText = model.accessibilityText {
|
if let accessibilityText = model.accessibilityText {
|
||||||
accessibilityLabel = accessibilityText
|
accessibilityLabel = accessibilityText
|
||||||
|
|||||||
@ -14,16 +14,15 @@ open class TextViewModel: TextEntryFieldModel {
|
|||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
public override class var identifier: String {
|
public override class var identifier: String {
|
||||||
return "textView"
|
return "textView"
|
||||||
}
|
}
|
||||||
|
|
||||||
public var accessibilityText: String?
|
public var accessibilityText: String?
|
||||||
public var textColor: Color = Color(uiColor: .mvmBlack)
|
public var textColor: Color = Color(uiColor: .mvmBlack)
|
||||||
public var fontStyle: Styler.Font = Styler.Font.RegularBodySmall
|
public var fontStyle: Styler.Font = Styler.Font.RegularBodySmall
|
||||||
public var textAlignment: NSTextAlignment = .left
|
public var textAlignment: NSTextAlignment = .left
|
||||||
public var height: CGFloat?
|
public var height: CGFloat?
|
||||||
public var placeholder: String = ""
|
|
||||||
public var placeholderTextColor: Color = Color(uiColor: .mvmCoolGray3)
|
public var placeholderTextColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||||
public var placeholderFontStyle: Styler.Font = Styler.Font.RegularMicro
|
public var placeholderFontStyle: Styler.Font = Styler.Font.RegularMicro
|
||||||
public var showsPlaceholder: Bool = true
|
public var showsPlaceholder: Bool = true
|
||||||
@ -53,30 +52,14 @@ open class TextViewModel: TextEntryFieldModel {
|
|||||||
case hideBlinkingCaret
|
case hideBlinkingCaret
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Initializer
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
public init(height: CGFloat, text: String = "") {
|
|
||||||
self.height = height
|
|
||||||
self.text = text
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Codec
|
// MARK: - Codec
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
|
try super.init(from: decoder)
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
if let text = try typeContainer.decodeIfPresent(String.self, forKey: .text) {
|
|
||||||
self.text = text
|
|
||||||
}
|
|
||||||
|
|
||||||
if let placeholder = try typeContainer.decodeIfPresent(String.self, forKey: .placeholder) {
|
|
||||||
self.placeholder = placeholder
|
|
||||||
}
|
|
||||||
|
|
||||||
if let placeholderFontStyle = try typeContainer.decodeIfPresent(Styler.Font.self, forKey: .placeholderFontStyle) {
|
if let placeholderFontStyle = try typeContainer.decodeIfPresent(Styler.Font.self, forKey: .placeholderFontStyle) {
|
||||||
self.placeholderFontStyle = placeholderFontStyle
|
self.placeholderFontStyle = placeholderFontStyle
|
||||||
}
|
}
|
||||||
@ -103,11 +86,10 @@ open class TextViewModel: TextEntryFieldModel {
|
|||||||
|
|
||||||
borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor)
|
borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor)
|
||||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
|
||||||
height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height)
|
height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public override func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user