caret title

This commit is contained in:
Suresh, Kamlesh 2020-01-17 11:04:35 -05:00
parent d8a7efde8a
commit 13dbb28357
2 changed files with 7 additions and 7 deletions

View File

@ -149,7 +149,7 @@ open class CaretButton: MFCustomButton, MVMCoreUIMoleculeViewProtocol, MVMCoreUI
}
isEnabled = caretLinkModel.enabled
set(with: caretLinkModel.action, delegateObject: delegateObject, additionalData: additionalData)
setTitle(caretLinkModel.label.text, for: .normal)
setTitle(caretLinkModel.title, for: .normal)
}
public func needsToBeConstrained() -> Bool {

View File

@ -12,20 +12,20 @@ import MVMCore
public class CaretLinkModel: MoleculeProtocol {
public static var identifier: String = "caretLink"
public var backgroundColor: Color?
public var label: LabelModel
public var title: String
public var action: ActionProtocol
public var enabledColor: Color = Color(uiColor: .black)
public var disabledColor: Color? = Color(uiColor: .mfSilver())
public var enabled: Bool = true
public init(label: LabelModel, action: ActionProtocol) {
self.label = label
public init(title: String, action: ActionProtocol) {
self.title = title
self.action = action
}
enum CodingKeys: String, CodingKey {
case backgroundColor
case label
case title
case action
case enabledColor
case disabledColor
@ -35,7 +35,7 @@ public class CaretLinkModel: MoleculeProtocol {
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
label = try typeContainer.decode(LabelModel.self, forKey: .label)
title = try typeContainer.decode(String.self, forKey: .title)
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .enabledColor) {
enabledColor = color
}
@ -50,7 +50,7 @@ public class CaretLinkModel: MoleculeProtocol {
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(label, forKey: .label)
try container.encode(title, forKey: .title)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeModel(action, forKey: .action)
try container.encode(enabled, forKey: .enabledColor)