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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,35 +8,58 @@
import Foundation import Foundation
public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtocol { public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "list2CTxtPrc2" public static var identifier: String = "list2CTxtPrc2"
public var leftLabel: LabelModel public var leftLabel: LabelModel
public var rightLabel: LabelModel public var rightLabel: LabelModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(leftLabel: LabelModel, rightLabel:LabelModel) { public init(leftLabel: LabelModel, rightLabel:LabelModel) {
self.leftLabel = leftLabel self.leftLabel = leftLabel
self.rightLabel = rightLabel self.rightLabel = rightLabel
super.init() super.init()
} }
/// Defaults to set //--------------------------------------------------
// MARK: - Method
//--------------------------------------------------
override public func setDefaults() { override public func setDefaults() {
super.setDefaults() super.setDefaults()
style = "none" style = "none"
if leftLabel.textColor == nil { if leftLabel.textColor == nil {
leftLabel.textColor = Color(uiColor: .mvmCoolGray6) leftLabel.textColor = Color(uiColor: .mvmCoolGray6)
} }
if rightLabel.textColor == nil { if rightLabel.textColor == nil {
rightLabel.textColor = Color(uiColor: .mvmCoolGray6) rightLabel.textColor = Color(uiColor: .mvmCoolGray6)
} }
} }
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName case moleculeName
case leftLabel case leftLabel
case rightLabel case rightLabel
} }
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)