diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift index cd103787..35968599 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift @@ -11,50 +11,53 @@ import Foundation @objcMembers open class ListFourColumnDataUsageDivider: TableViewCell { // MARK: - MFViewProtocol - let label1 = Label.commonLabelB1(true) - let label2 = Label.commonLabelB1(true) - let label3 = Label.commonLabelB1(true) - let label4 = Label.commonLabelB1(true) - let stack = Stack(frame: .zero) + let label1 = Label.createLabelBoldBodySmall(true) + let label2 = Label.createLabelBoldBodySmall(true) + let label3 = Label.createLabelBoldBodySmall(true) + let label4 = Label.createLabelBoldBodySmall(true) + var stack: Stack + + // MARK: - Initializers + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: label1, model: StackItemModel(percent: 19, horizontalAlignment: .leading)), + (view: label2, model: StackItemModel(percent: 44, horizontalAlignment: .leading)), + (view: label3, model: StackItemModel(percent: 17, horizontalAlignment: .leading)), + (view: label4, model: StackItemModel(percent: 20, horizontalAlignment: .leading))], + axis: .horizontal, spacing: 8) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } // MARK: - MFViewProtocol open override func setupView() { super.setupView() - stack.stackItems = [StackItem(andContain: label1), - StackItem(andContain: label2), - StackItem(andContain: label3), - StackItem(andContain: label4)] addMolecule(stack) + stack.restack() } // MARK: - MVMCoreUIMoleculeViewProtocol - open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - super.setWithModel(model, delegateObject, additionalData) + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) guard let model = model as? ListFourColumnDataUsageDividerModel else { return } - label1.setWithModel(model.label1, delegateObject, additionalData) - label2.setWithModel(model.label2, delegateObject, additionalData) - label3.setWithModel(model.label3, delegateObject, additionalData) - label4.setWithModel(model.label4, delegateObject, additionalData) - //Create a stack model to use for the internal stack and set the alignment of labels - let stackModel = StackModel(molecules: [StackItemModel(percent: 15, horizontalAlignment: .leading), - StackItemModel(percent: 35, horizontalAlignment: .leading), - StackItemModel(percent: 30, horizontalAlignment: .trailing), - StackItemModel(percent: 20, horizontalAlignment: .trailing)], - axis: .horizontal) - stack.model = stackModel - stack.restack() + label1.set(with: model.label1, delegateObject, additionalData) + label2.set(with: model.label2, delegateObject, additionalData) + label3.set(with: model.label3, delegateObject, additionalData) + label4.set(with: model.label4, delegateObject, additionalData) } // MARK: - MVMCoreUIMoleculeViewProtocol open override func reset() { super.reset() - label1.styleB1(true) - label2.styleB1(true) - label3.styleB1(true) - label4.styleB1(true) + label1.styleBoldBodySmall(true) + label2.styleBoldBodySmall(true) + label3.styleBoldBodySmall(true) + label4.styleBoldBodySmall(true) } - open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { return 121 } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift index 1277f4bb..f9ce88d8 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift @@ -21,10 +21,9 @@ public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelPr self.label3 = label3 self.label4 = label4 super.init() - setDefaults() } - // Defaults to set + /// Defaults to set override public func setDefaults() { super.setDefaults() style = "tallDivider"