caret title
This commit is contained in:
parent
d8a7efde8a
commit
13dbb28357
@ -149,7 +149,7 @@ open class CaretButton: MFCustomButton, MVMCoreUIMoleculeViewProtocol, MVMCoreUI
|
|||||||
}
|
}
|
||||||
isEnabled = caretLinkModel.enabled
|
isEnabled = caretLinkModel.enabled
|
||||||
set(with: caretLinkModel.action, delegateObject: delegateObject, additionalData: additionalData)
|
set(with: caretLinkModel.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
setTitle(caretLinkModel.label.text, for: .normal)
|
setTitle(caretLinkModel.title, for: .normal)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func needsToBeConstrained() -> Bool {
|
public func needsToBeConstrained() -> Bool {
|
||||||
|
|||||||
@ -12,20 +12,20 @@ import MVMCore
|
|||||||
public class CaretLinkModel: MoleculeProtocol {
|
public class CaretLinkModel: MoleculeProtocol {
|
||||||
public static var identifier: String = "caretLink"
|
public static var identifier: String = "caretLink"
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var label: LabelModel
|
public var title: String
|
||||||
public var action: ActionProtocol
|
public var action: ActionProtocol
|
||||||
public var enabledColor: Color = Color(uiColor: .black)
|
public var enabledColor: Color = Color(uiColor: .black)
|
||||||
public var disabledColor: Color? = Color(uiColor: .mfSilver())
|
public var disabledColor: Color? = Color(uiColor: .mfSilver())
|
||||||
public var enabled: Bool = true
|
public var enabled: Bool = true
|
||||||
|
|
||||||
public init(label: LabelModel, action: ActionProtocol) {
|
public init(title: String, action: ActionProtocol) {
|
||||||
self.label = label
|
self.title = title
|
||||||
self.action = action
|
self.action = action
|
||||||
}
|
}
|
||||||
|
|
||||||
enum CodingKeys: String, CodingKey {
|
enum CodingKeys: String, CodingKey {
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case label
|
case title
|
||||||
case action
|
case action
|
||||||
case enabledColor
|
case enabledColor
|
||||||
case disabledColor
|
case disabledColor
|
||||||
@ -35,7 +35,7 @@ public class CaretLinkModel: MoleculeProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
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) {
|
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .enabledColor) {
|
||||||
enabledColor = color
|
enabledColor = color
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ public class CaretLinkModel: MoleculeProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
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.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeModel(action, forKey: .action)
|
try container.encodeModel(action, forKey: .action)
|
||||||
try container.encode(enabled, forKey: .enabledColor)
|
try container.encode(enabled, forKey: .enabledColor)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user