adding comments

This commit is contained in:
Kevin G Christiano 2020-06-03 17:11:57 -04:00
parent 77dbd5d473
commit acab145af7
8 changed files with 140 additions and 31 deletions

View File

@ -8,11 +8,12 @@
import Foundation
@objcMembers open class ListTwoColumnCompareChanges: TableViewCell {
//-------------------------------------------------------
// MARK: - Outlets
//-------------------------------------------------------
let leftHeadline1 = Label.createLabelBoldBodySmall(true)
let leftHeadline2 = Label.createLabelBoldBodySmall(true)
let leftHeadline3 = Label.createLabelBoldBodySmall(true)
@ -23,11 +24,18 @@ import Foundation
let rightHeadline3 = Label.createLabelBoldBodySmall(true)
let rightBody = Label.createLabelRegularBodySmall(true)
let rightLink = Link()
//------------------------------------------------------
// MARK: - Properties
//------------------------------------------------------
let containingStack: Stack<StackModel>
let stackSpacing: CGFloat = 5.0
//------------------------------------------------------
// MARK: - Initializers
//------------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
let stackHeadline1 = Stack<StackModel>.createStack(with: [(view: leftHeadline1, model: StackItemModel(percent: 50, verticalAlignment: .leading)),
(view: rightHeadline1, model: StackItemModel(percent: 50, verticalAlignment: .leading))],
@ -44,11 +52,7 @@ import Foundation
let stackLink = Stack<StackModel>.createStack(with: [(view: leftLink, model: StackItemModel(percent: 50, verticalAlignment: .leading)),
(view: rightLink, model: StackItemModel(percent: 50, verticalAlignment: .leading))],
axis: .horizontal)
containingStack = Stack<StackModel>.createStack(with: [stackHeadline1,
stackHeadline2,
stackHeadline3,
stackBody,
stackLink],
containingStack = Stack<StackModel>.createStack(with: [stackHeadline1, stackHeadline2, stackHeadline3, stackBody, stackLink],
spacing: 0)
containingStack.stackModel?.molecules[1].spacing = 5
containingStack.stackModel?.molecules[2].spacing = 5
@ -60,16 +64,12 @@ import Foundation
fatalError("init(coder:) has not been implemented")
}
//------------------------------------------------------
// MARK: - Properties
//------------------------------------------------------
let stackSpacing: CGFloat = 5.0
//-------------------------------------------------------
// MARK: - View Lifecycle
// MARK: - Lifecycle
//-------------------------------------------------------
open override func setupView() {
super.setupView()
addMolecule(containingStack)
for molecule in containingStack.stackItems {
((molecule as? StackItem)?.view as? Stack<StackModel>)?.restack()
@ -80,9 +80,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? ListTwoColumnCompareChangesModel else { return }
leftHeadline1.set(with: model.leftHeadline1, delegateObject, additionalData)
leftHeadline2.set(with: model.leftHeadline2, delegateObject, additionalData)
leftHeadline3.set(with: model.leftHeadline3, delegateObject, additionalData)

View File

@ -8,7 +8,11 @@
import Foundation
public class ListTwoColumnCompareChangesModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "list2CCmpr1"
public var leftHeadline1: LabelModel
@ -22,6 +26,10 @@ public class ListTwoColumnCompareChangesModel: ListItemModel, MoleculeModelProto
public var rightBody: LabelModel
public var rightLink: LinkModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(leftHeadline1: LabelModel, leftHeadline2: LabelModel, leftHeadline3: LabelModel, leftBody: LabelModel, leftLink: LinkModel, rightHeadline1: LabelModel, rightHeadline2: LabelModel, rightHeadline3: LabelModel, rightBody: LabelModel, rightLink: LinkModel) {
self.leftHeadline1 = leftHeadline1
self.leftHeadline2 = leftHeadline2
@ -36,6 +44,10 @@ public class ListTwoColumnCompareChangesModel: ListItemModel, MoleculeModelProto
super.init()
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case leftHeadline1
@ -50,6 +62,10 @@ public class ListTwoColumnCompareChangesModel: ListItemModel, MoleculeModelProto
case rightLink
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
leftHeadline1 = try typeContainer.decode(LabelModel.self, forKey: .leftHeadline1)

View File

@ -8,8 +8,8 @@
import Foundation
@objcMembers public class ListTwoColumnDropdownSelectors: TableViewCell {
//-------------------------------------------------------
// MARK: - Outlets
//-------------------------------------------------------
@ -34,7 +34,7 @@ import Foundation
}
//-------------------------------------------------------
// MARK: - View Lifecycle
// MARK: - Lifecycle
//-------------------------------------------------------
open override func setupView() {
@ -45,11 +45,13 @@ 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? ListTwoColumnDropdownSelectorsModel else { return }
leftDropDown.set(with:model.leftDropDown, delegateObject, additionalData)
rightDropDown.set(with:model.rightDropDown, delegateObject, additionalData)
}

View File

@ -8,23 +8,33 @@
import Foundation
public class ListTwoColumnDropdownSelectorsModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "list2CDrpDrp1"
public var leftDropDown: ItemDropdownEntryFieldModel
public var rightDropDown: ItemDropdownEntryFieldModel
// Defaults to set
//--------------------------------------------------
// MARK: - Method
//--------------------------------------------------
override public func setDefaults() {
if useHorizontalMargins == nil {
useHorizontalMargins = true
}
if useVerticalMargins == nil {
useVerticalMargins = true
}
if topPadding == nil {
topPadding = 20
}
if bottomPadding == nil {
bottomPadding = 0
}
@ -32,18 +42,30 @@ public class ListTwoColumnDropdownSelectorsModel: ListItemModel, MoleculeModelPr
line = LineModel(type: .none)
}
}
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(leftDropDown: ItemDropdownEntryFieldModel, rightDropDown: ItemDropdownEntryFieldModel) {
self.leftDropDown = leftDropDown
self.rightDropDown = rightDropDown
super.init()
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case leftDropDown
case rightDropDown
}
case moleculeName
case leftDropDown
case rightDropDown
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)

View File

@ -8,11 +8,12 @@
import Foundation
@objcMembers open class ListTwoColumnPriceDescription: TableViewCell {
//-----------------------------------------------------
// MARK: - Outlets
//-------------------------------------------------------
//-----------------------------------------------------
public let leftHeadline = Label.createLabelBoldBodySmall(true)
public let leftBody = Label.createLabelRegularBodySmall(true)
public let rightLabel = Label.createLabelRegularBodySmall(true)
@ -25,6 +26,7 @@ import Foundation
//------------------------------------------------------
// MARK: - Initializers
//------------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
leftVerticalStack = UIStackView(arrangedSubviews: [leftHeadline, leftBody])
leftVerticalStack.axis = .vertical
@ -40,8 +42,9 @@ import Foundation
}
//-----------------------------------------------------
// MARK: - View Lifecycle
//-------------------------------------------------------
// MARK: - Lifecycle
//-----------------------------------------------------
open override func updateView(_ size: CGFloat) {
super.updateView(size)
leftVerticalStack.updateView(size)
@ -50,6 +53,7 @@ import Foundation
override open func setupView() {
super.setupView()
contentView.addSubview(view)
containerHelper.constrainView(view)
@ -65,13 +69,16 @@ import Foundation
rightLabel.numberOfLines = 1
rightSubLabel.numberOfLines = 1
}
//----------------------------------------------------
// 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? ListTwoColumnPriceDescriptionModel else { return }
leftHeadline.set(with: model.leftHeadline, delegateObject, additionalData)
leftBody.set(with: model.leftBody, delegateObject, additionalData)
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)

View File

@ -8,24 +8,40 @@
import Foundation
public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "list2CTxtPrc1"
public var leftHeadline: LabelModel
public var leftBody: LabelModel
public var rightLabel: LabelModel
public var rightSubLabel: LabelModel
//--------------------------------------------------
// MARK: - Methods
//--------------------------------------------------
override public func setDefaults() {
super.setDefaults()
rightLabel.hero = 0
if rightSubLabel.textColor == nil {
rightSubLabel.textColor = Color(uiColor: .mvmCoolGray6)
}
if rightSubLabel.attributes == nil {
rightSubLabel.attributes = [LabelAttributeStrikeThroughModel(0, rightSubLabel.text.count)]
}
}
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(leftHeadline: LabelModel,leftBody: LabelModel, rightLabel: LabelModel, rightSubLabel: LabelModel) {
self.leftHeadline = leftHeadline
self.leftBody = leftBody
@ -34,6 +50,10 @@ public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelPro
super.init()
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case leftHeadline
@ -42,6 +62,10 @@ public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelPro
case rightSubLabel
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
leftHeadline = try typeContainer.decode(LabelModel.self, forKey: .leftHeadline)

View File

@ -8,13 +8,20 @@
import UIKit
@objcMembers open class ListTwoColumnPriceDetails: TableViewCell {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
let leftLabel = Label.createLabelRegularBodySmall(true)
let rightLabel = Label.createLabelRegularBodySmall(true)
let view = MVMCoreUICommonViewsUtility.commonView()
// MARK: - MFViewProtocol
//--------------------------------------------------
// MARK: - Lifecycle
//--------------------------------------------------
open override func setupView() {
super.setupView()
view.addSubview(leftLabel)
@ -32,10 +39,15 @@ import UIKit
rightLabel.updateView(size)
}
//--------------------------------------------------
// 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? ListTwoColumnPriceDetailsModel else { return }
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
}

View File

@ -8,35 +8,58 @@
import Foundation
public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "list2CTxtPrc2"
public var leftLabel: LabelModel
public var rightLabel: LabelModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(leftLabel: LabelModel, rightLabel:LabelModel) {
self.leftLabel = leftLabel
self.rightLabel = rightLabel
super.init()
}
/// Defaults to set
//--------------------------------------------------
// MARK: - Method
//--------------------------------------------------
override public func setDefaults() {
super.setDefaults()
style = "none"
if leftLabel.textColor == nil {
leftLabel.textColor = Color(uiColor: .mvmCoolGray6)
}
if rightLabel.textColor == nil {
rightLabel.textColor = Color(uiColor: .mvmCoolGray6)
}
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case leftLabel
case rightLabel
}
//--------------------------------------------------
// 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)