restructuring and commenting

This commit is contained in:
Kevin G Christiano 2020-06-03 10:47:18 -04:00
parent 7a9f9bd2c5
commit 0e6a4ef818
16 changed files with 358 additions and 50 deletions

View File

@ -78,6 +78,10 @@ import Foundation
return 140
}
//--------------------------------------------------
// MARK: - Accessibility
//--------------------------------------------------
func updateAccessibilityLabel() {
var message = ""

View File

@ -62,6 +62,7 @@ import Foundation
//----------------------------------------------------
// MARK: - Molecule
//----------------------------------------------------
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
@ -80,6 +81,10 @@ import Foundation
checkbox.isSelected.toggle()
}
//----------------------------------------------------
// MARK: - Accessibility
//----------------------------------------------------
func updateAccessibilityLabel() {
var message = ""

View File

@ -7,8 +7,14 @@
//
import Foundation
@objcMembers open class ListRVWheel: TableViewCell {
let wheel = Wheel(frame: .zero)
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
let wheel = Wheel()
let leftLabel = Label.createLabelBoldBodySmall(true)
let rightLabel = Label.createLabelRegularBodySmall(true)
var stack: Stack<StackModel>
@ -16,6 +22,7 @@ import Foundation
//-----------------------------------------------------
// MARK: - Initializers
//-----------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .leading)),
(view: wheel, model: StackItemModel(horizontalAlignment: .fill)),
@ -31,6 +38,7 @@ import Foundation
//-------------------------------------------------
// MARK: - Setup
//-------------------------------------------------
open override func setupView() {
super.setupView()
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
@ -41,17 +49,17 @@ import Foundation
//-------------------------------------------------
// MARK: - MoleculeViewProtocol
//-------------------------------------------------
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListRVWheelModel else { return }
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
wheel.set(with: model.wheel, delegateObject, additionalData)
}
//-------------------------------------------------
// MARK: - MoleculeViewProtocol
//-------------------------------------------------
open override func reset() {
super.reset()
leftLabel.styleBoldBodySmall(true)

View File

@ -7,12 +7,22 @@
//
import Foundation
public class ListRVWheelModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "listRVWheel"
public var leftLabel: LabelModel
public var rightLabel: LabelModel
public var wheel: WheelModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(leftLabel: LabelModel, rightLabel: LabelModel, wheel: WheelModel) {
self.leftLabel = leftLabel
self.rightLabel = rightLabel
@ -20,12 +30,19 @@ public class ListRVWheelModel: ListItemModel, MoleculeModelProtocol {
super.init()
}
/// Defaults to set
//--------------------------------------------------
// MARK: - Method
//--------------------------------------------------
override public func setDefaults() {
super.setDefaults()
rightLabel.hero = 0
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case leftLabel
@ -33,6 +50,10 @@ public class ListRVWheelModel: ListItemModel, MoleculeModelProtocol {
case wheel
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)

View File

@ -7,19 +7,24 @@
//
import Foundation
@objcMembers open class ListRightVariableButtonAllTextAndLinks: TableViewCell {
//-----------------------------------------------------
// MARK: - Outlets
//-----------------------------------------------------
public var stack: Stack<StackModel>
public let button = PillButton(frame: .zero)
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
public var stack: Stack<StackModel>
public let button = PillButton()
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading)),
(view: button, model: StackItemModel(horizontalAlignment:.fill))],
(view: button, model: StackItemModel(horizontalAlignment: .fill))],
axis: .horizontal)
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
@ -29,23 +34,81 @@ import Foundation
}
//-----------------------------------------------------
// MARK: - View Lifecycle
// MARK: - Lifecycle
//-----------------------------------------------------
override open func setupView() {
super.setupView()
addMolecule(stack)
stack.restack()
updateAccessibilityLabel()
}
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
//-----------------------------------------------------
// MARK: - Molecular
//-----------------------------------------------------
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListRightVariableButtonAllTextAndLinksModel else { return }
button.set(with: model.button, delegateObject, additionalData)
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
updateAccessibilityLabel()
}
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
return 90
}
//----------------------------------------------------
// MARK: - Accessibility
//----------------------------------------------------
func updateAccessibilityLabel() {
var message = ""
if let checkboxLabel = button.accessibilityLabel {
message += checkboxLabel + ", "
}
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
message += eyebrowLabel + ", "
}
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
message += headlineLabel + ", "
}
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
message += bodyLabel
}
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
isAccessibilityElement = !linkShowing
button.isAccessibilityElement = linkShowing
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
if !linkShowing {
// Make whole cell focusable if no link.
accessibilityLabel = message
} else {
// Allow only radio button and link to be focused on.
button.accessibilityLabel = message
var elements: [UIView] = []
if !message.isEmpty {
elements.append(button)
}
if linkShowing {
elements.append(eyebrowHeadlineBodyLink.link)
}
accessibilityElements = elements
}
}
}

View File

@ -7,30 +7,51 @@
//
import Foundation
public class ListRightVariableButtonAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "listRVBtn"
public var button: ButtonModel
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(button: ButtonModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
self.button = button
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
super.init()
}
/// Defaults to set
//--------------------------------------------------
// MARK: - Methods
//--------------------------------------------------
override public func setDefaults() {
super.setDefaults()
self.button.size = .tiny
self.button.style = .secondary
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case button
case eyebrowHeadlineBodyLink
}
//--------------------------------------------------
// MARK: - codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
button = try typeContainer.decode(ButtonModel.self, forKey: .button)
@ -46,4 +67,3 @@ public class ListRightVariableButtonAllTextAndLinksModel: ListItemModel, Molecul
try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink)
}
}

View File

@ -8,11 +8,12 @@
import Foundation
@objcMembers open class ListRightVariablePayments: TableViewCell {
//-----------------------------------------------------
// MARK: - Outlets
//-------------------------------------------------------
//-----------------------------------------------------
let leftLabel = Label.createLabelBoldBodySmall(true)
let rightImage = LoadImageView(pinnedEdges: .all)
var stack: Stack<StackModel>
@ -32,8 +33,9 @@ import Foundation
}
//-----------------------------------------------------
// MARK: - View Lifecycle
//-------------------------------------------------------
// MARK: - Lifecycle
//-----------------------------------------------------
override open func setupView() {
super.setupView()
rightImage.addSizeConstraintsForAspectRatio = true
@ -44,9 +46,12 @@ import Foundation
//----------------------------------------------------
// MARK: - Molecule
//------------------------------------------------------
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListRightVariablePaymentsModel else { return }
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
rightImage.set(with: model.image, delegateObject, additionalData)
}

View File

@ -8,19 +8,30 @@
import Foundation
public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "listRVImg"
public var image: ImageViewModel
public var leftLabel: LabelModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(image: ImageViewModel, leftLabel: LabelModel) {
self.leftLabel = leftLabel
self.image = image
super.init()
}
/// Defaults to set
//--------------------------------------------------
// MARK: - Methods
//--------------------------------------------------
override public func setDefaults() {
super.setDefaults()
leftLabel.hero = 0
@ -35,12 +46,20 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco
return image
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case leftLabel
case image
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)

View File

@ -8,13 +8,14 @@
import Foundation
@objcMembers open class ListRightVariablePriceChangeAllTextAndLinks: TableViewCell {
//-----------------------------------------------------
// MARK: - Outlets
//-----------------------------------------------------
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
public let arrow = Arrow(frame: .zero)
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
public let arrow = Arrow()
public let rightLabel = Label.createLabelRegularBodySmall(true)
private let stack: Stack<StackModel>
private let arrowStackItem: StackItem
@ -23,6 +24,7 @@ import Foundation
//-----------------------------------------------------
// MARK: - Initializers
//-----------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
let stackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .leading),
StackItemModel(horizontalAlignment: .fill),
@ -40,7 +42,7 @@ import Foundation
}
//-----------------------------------------------------
// MARK: - View Lifecycle
// MARK: - Lifecycle
//-----------------------------------------------------
open override func alignAccessoryToHero() -> CGPoint? {
@ -52,11 +54,13 @@ import Foundation
arrowStackItem.containerHelper.alignCenterVerticalConstraint?.constant = convertedPoint.y - stack.bounds.midY
rightLabelStackItem.containerHelper.alignCenterVerticalConstraint?.constant = convertedPoint.y - stack.bounds.midY
}
return heroCenter
}
open override func setupView() {
super.setupView()
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.numberOfLines = 1
@ -67,9 +71,11 @@ import Foundation
stack.restack()
}
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListRightVariablePriceChangeAllTextAndLinksModel else { return }
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
arrow.set(with: model.arrow, delegateObject, additionalData)
@ -78,5 +84,56 @@ import Foundation
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
return 121
}
//--------------------------------------------------
// MARK: - Accessibility
//--------------------------------------------------
func updateAccessibilityLabel() {
var message = ""
checkbox.updateAccessibilityLabel()
if let checkboxLabel = checkbox.accessibilityLabel {
message += checkboxLabel + ", "
}
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
message += eyebrowLabel + ", "
}
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
message += headlineLabel + ", "
}
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
message += bodyLabel
}
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
isAccessibilityElement = !linkShowing
checkbox.isAccessibilityElement = linkShowing
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
if !linkShowing {
// Make whole cell focusable if no link.
accessibilityLabel = message
} else {
// Allow only radio button and link to be focused on.
checkbox.accessibilityLabel = message
var elements: [UIView] = []
if message.count > 0 {
elements.append(checkbox)
}
if linkShowing {
elements.append(eyebrowHeadlineBodyLink.link)
}
accessibilityElements = elements
}
}
}

View File

@ -8,12 +8,21 @@
import Foundation
public class ListRightVariablePriceChangeAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "listRVArwAll"
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
public var rightLabel: LabelModel
public var arrow: ArrowModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel, rightLabel: LabelModel, arrow: ArrowModel) {
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
self.rightLabel = rightLabel
@ -21,6 +30,10 @@ public class ListRightVariablePriceChangeAllTextAndLinksModel: ListItemModel, Mo
super.init()
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case eyebrowHeadlineBodyLink
@ -28,6 +41,10 @@ public class ListRightVariablePriceChangeAllTextAndLinksModel: ListItemModel, Mo
case arrow
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
eyebrowHeadlineBodyLink = try typeContainer.decode(EyebrowHeadlineBodyLinkModel.self, forKey: .eyebrowHeadlineBodyLink)

View File

@ -7,19 +7,23 @@
//
import Foundation
@objcMembers open class ListRightVariablePriceChangeBodyText: TableViewCell {
//-----------------------------------------------------
// MARK: - Outlets
//-----------------------------------------------------
private let stack: Stack<StackModel>
public let headlineBody = HeadlineBody(frame: .zero)
public let arrow = Arrow(frame: .zero)
public let headlineBody = HeadlineBody()
public let arrow = Arrow()
public let rightLabel = Label.createLabelRegularBodySmall(true)
let arrowAndRightLabelStack: Stack<StackModel>
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
arrowAndRightLabelStack = Stack<StackModel>.createStack(with: [(view: arrow, model: StackItemModel(horizontalAlignment: .fill)),
(view: rightLabel, model: StackItemModel(horizontalAlignment: .fill))],
@ -35,8 +39,9 @@ import Foundation
}
//-----------------------------------------------------
// MARK: - View Lifecycle
// MARK: - Lifecycle
//-----------------------------------------------------
open override func setupView() {
super.setupView()
headlineBody.styleListItem()
@ -51,9 +56,15 @@ import Foundation
arrowAndRightLabelStack.restack()
}
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
//--------------------------------------------------
// MARK: - Molecular
//--------------------------------------------------
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListRightVariablePriceChangeBodyTextModel else { return }
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
arrow.set(with: model.arrow, delegateObject, additionalData)

View File

@ -7,12 +7,22 @@
//
import Foundation
public class ListRightVariablePriceChangeBodyTextModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "listRVArwBdy"
public var headlineBody: HeadlineBodyModel
public var rightLabel: LabelModel
public var arrow: ArrowModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(headlineBody: HeadlineBodyModel,rightLabel: LabelModel,arrow: ArrowModel) {
self.headlineBody = headlineBody
self.rightLabel = rightLabel
@ -20,7 +30,10 @@ public class ListRightVariablePriceChangeBodyTextModel: ListItemModel, MoleculeM
super.init()
}
/// Defaults to set
//--------------------------------------------------
// MARK: - Methods
//--------------------------------------------------
public override func setDefaults() {
super.setDefaults()
if let headline = headlineBody.headline {
@ -28,6 +41,10 @@ public class ListRightVariablePriceChangeBodyTextModel: ListItemModel, MoleculeM
}
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case headlineBody
@ -35,6 +52,10 @@ public class ListRightVariablePriceChangeBodyTextModel: ListItemModel, MoleculeM
case arrow
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody)

View File

@ -7,16 +7,21 @@
//
import Foundation
@objcMembers open class ListRightVariableTextLinkAllTextAndLinks: TableViewCell {
//-----------------------------------------------------
//--------------------------------------------------
// MARK: - Outlets
//-----------------------------------------------------
public var stack: Stack<StackModel>
public let link = Link(frame: .zero)
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
//--------------------------------------------------
public var stack: Stack<StackModel>
public let link = Link()
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)),
(view: link, model: StackItemModel(horizontalAlignment:.fill, verticalAlignment: .top))],
@ -29,17 +34,24 @@ import Foundation
}
//-----------------------------------------------------
// MARK: - View Lifecycle
// MARK: - Lifecycle
//-----------------------------------------------------
override open func setupView() {
super.setupView()
addMolecule(stack)
stack.restack()
}
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
//--------------------------------------------------
// MARK: - Molecular
//--------------------------------------------------
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListRightVariableTextLinkAllTextAndLinksModel else { return }
link.set(with: model.link, delegateObject, additionalData)
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
}

View File

@ -7,23 +7,41 @@
//
import Foundation
public class ListRightVariableTextLinkAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "listRVLink"
public var link: LinkModel
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(link: LinkModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
self.link = link
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
super.init()
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case link
case eyebrowHeadlineBodyLink
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
link = try typeContainer.decode(LinkModel.self, forKey: .link)

View File

@ -8,11 +8,12 @@
import Foundation
@objcMembers open class ListRightVariableTotalData: TableViewCell {
//-----------------------------------------------------
// MARK: - Outlets
//-----------------------------------------------------
public var stack: Stack<StackModel>
public let leftLabel = Label.createLabelBoldBodySmall(true)
public let rightLabel = Label.createLabelRegularBodySmall(true)
@ -35,8 +36,8 @@ import Foundation
}
//-----------------------------------------------------
// MARK: - View Lifecycle
//-------------------------------------------------------
// MARK: - Lifecycle
//-----------------------------------------------------
override open func setupView() {
super.setupView()
@ -47,15 +48,21 @@ import Foundation
stack.restack()
}
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){
//--------------------------------------------------
// MARK: - Molecular
//--------------------------------------------------
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListRightVariableTotalDataModel else { return }
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
bar.set(with: model.bar, delegateObject, additionalData)
}
open override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat?{
open override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
return 70
}

View File

@ -8,13 +8,21 @@
import Foundation
public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "listRVLine"
public var leftLabel: LabelModel
public var rightLabel: LabelModel
public var bar: LineModel
//--------------------------------------------------
// MARK: - Method
//--------------------------------------------------
override public func setDefaults() {
super.setDefaults()
rightLabel.hero = 0
@ -24,13 +32,21 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
}
}
public init (leftLabel: LabelModel, rightlabel:LabelModel, bar: LineModel){
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(leftLabel: LabelModel, rightlabel:LabelModel, bar: LineModel){
self.leftLabel = leftLabel
self.rightLabel = rightlabel
self.bar = bar
super.init()
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey{
case moleculeName
case leftLabel
@ -38,6 +54,10 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
case bar
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)