formatting

This commit is contained in:
Kevin G Christiano 2020-05-27 10:42:37 -04:00
parent 3ec07412c2
commit b84a6b4ccd
2 changed files with 33 additions and 4 deletions

View File

@ -8,16 +8,22 @@
import Foundation
@objcMembers open class ListFourColumnDataUsageDivider: TableViewCell {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
// MARK: - MFViewProtocol
let label1 = Label.createLabelBoldBodySmall(true)
let label2 = Label.createLabelBoldBodySmall(true)
let label3 = Label.createLabelBoldBodySmall(true)
let label4 = Label.createLabelBoldBodySmall(true)
var stack: Stack<StackModel>
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: label1, model: StackItemModel(percent: 19, horizontalAlignment: .leading)),
(view: label2, model: StackItemModel(percent: 44, horizontalAlignment: .leading)),
@ -31,17 +37,25 @@ import Foundation
fatalError("init(coder:) has not been implemented")
}
//--------------------------------------------------
// MARK: - MFViewProtocol
//--------------------------------------------------
open override func setupView() {
super.setupView()
addMolecule(stack)
stack.restack()
}
//--------------------------------------------------
// 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? ListFourColumnDataUsageDividerModel else { return }
label1.set(with: model.label1, delegateObject, additionalData)
label2.set(with: model.label2, delegateObject, additionalData)
label3.set(with: model.label3, delegateObject, additionalData)
@ -52,7 +66,6 @@ import Foundation
return 121
}
// MARK: - MoleculeViewProtocol
open override func reset() {
super.reset()
label1.styleBoldBodySmall(true)

View File

@ -8,13 +8,22 @@
import Foundation
public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "list4CDiv"
public var label1: LabelModel
public var label2: LabelModel
public var label3: LabelModel
public var label4: LabelModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(label1: LabelModel, label2: LabelModel, label3: LabelModel, label4: LabelModel) {
self.label1 = label1
self.label2 = label2
@ -23,12 +32,15 @@ public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelPr
super.init()
}
/// Defaults to set
override public func setDefaults() {
super.setDefaults()
style = "tallDivider"
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case label1
@ -37,6 +49,10 @@ public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelPr
case label4
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
label1 = try typeContainer.decode(LabelModel.self, forKey: .label1)