updated model
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
3eaf765655
commit
2e937fd0de
@ -5,7 +5,7 @@
|
|||||||
// Created by Suresh, Kamlesh on 10/3/19.
|
// Created by Suresh, Kamlesh on 10/3/19.
|
||||||
// Copyright © 2019 Suresh, Kamlesh. All rights reserved.
|
// Copyright © 2019 Suresh, Kamlesh. All rights reserved.
|
||||||
//
|
//
|
||||||
|
import VDS
|
||||||
|
|
||||||
@objcMembers open class LabelModel: MoleculeModelProtocol {
|
@objcMembers open class LabelModel: MoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -30,6 +30,7 @@
|
|||||||
public var numberOfLines: Int?
|
public var numberOfLines: Int?
|
||||||
public var shouldMaskRecordedView: Bool? = false
|
public var shouldMaskRecordedView: Bool? = false
|
||||||
public var accessibilityTraits: UIAccessibilityTraits?
|
public var accessibilityTraits: UIAccessibilityTraits?
|
||||||
|
public var inverted: Bool = false
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
@ -49,6 +50,7 @@
|
|||||||
case attributes
|
case attributes
|
||||||
case html
|
case html
|
||||||
case hero
|
case hero
|
||||||
|
case inverted
|
||||||
case makeWholeViewClickable
|
case makeWholeViewClickable
|
||||||
case numberOfLines
|
case numberOfLines
|
||||||
case shouldMaskRecordedView
|
case shouldMaskRecordedView
|
||||||
@ -97,6 +99,7 @@
|
|||||||
attributes = try typeContainer.decodeModelsIfPresent(codingKey: .attributes)
|
attributes = try typeContainer.decodeModelsIfPresent(codingKey: .attributes)
|
||||||
html = try typeContainer.decodeIfPresent(String.self, forKey: .html)
|
html = try typeContainer.decodeIfPresent(String.self, forKey: .html)
|
||||||
hero = try typeContainer.decodeIfPresent(Int.self, forKey: .hero)
|
hero = try typeContainer.decodeIfPresent(Int.self, forKey: .hero)
|
||||||
|
inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
||||||
makeWholeViewClickable = try typeContainer.decodeIfPresent(Bool.self, forKey: .makeWholeViewClickable)
|
makeWholeViewClickable = try typeContainer.decodeIfPresent(Bool.self, forKey: .makeWholeViewClickable)
|
||||||
numberOfLines = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfLines)
|
numberOfLines = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfLines)
|
||||||
shouldMaskRecordedView = try typeContainer.decodeIfPresent(Bool.self, forKey: .shouldMaskRecordedView) ?? false
|
shouldMaskRecordedView = try typeContainer.decodeIfPresent(Bool.self, forKey: .shouldMaskRecordedView) ?? false
|
||||||
@ -123,9 +126,14 @@
|
|||||||
try container.encodeModelsIfPresent(attributes, forKey: .attributes)
|
try container.encodeModelsIfPresent(attributes, forKey: .attributes)
|
||||||
try container.encodeIfPresent(html, forKey: .html)
|
try container.encodeIfPresent(html, forKey: .html)
|
||||||
try container.encodeIfPresent(hero, forKey: .hero)
|
try container.encodeIfPresent(hero, forKey: .hero)
|
||||||
|
try container.encodeIfPresent(inverted, forKey: .inverted)
|
||||||
try container.encodeIfPresent(makeWholeViewClickable, forKey: .makeWholeViewClickable)
|
try container.encodeIfPresent(makeWholeViewClickable, forKey: .makeWholeViewClickable)
|
||||||
try container.encodeIfPresent(numberOfLines, forKey: .numberOfLines)
|
try container.encodeIfPresent(numberOfLines, forKey: .numberOfLines)
|
||||||
try container.encodeIfPresent(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
|
try container.encodeIfPresent(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
|
||||||
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
|
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension LabelModel {
|
||||||
|
public var surface: Surface { inverted ? .dark : .light }
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user