This commit is contained in:
Pfeil, Scott Robert 2020-04-06 11:54:14 -04:00
parent 3ec2150afe
commit a601041c5f
3 changed files with 17 additions and 28 deletions

View File

@ -946,7 +946,6 @@
52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */, 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */,
8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */, 8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */,
8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */, 8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */,
8DFB6D89242A134600A3F715 /* ThreeColumn */,
); );
path = OneColumn; path = OneColumn;
sourceTree = "<group>"; sourceTree = "<group>";
@ -998,14 +997,6 @@
path = ThreeColumn; path = ThreeColumn;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
8DFB6D89242A134600A3F715 /* ThreeColumn */ = {
isa = PBXGroup;
children = (
);
name = ThreeColumn;
path = ../ThreeColumn;
sourceTree = "<group>";
};
94C01508242155FE005811A9 /* Actions */ = { 94C01508242155FE005811A9 /* Actions */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (

View File

@ -13,21 +13,26 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-----------------------------------------------------
var stack: Stack<StackModel> open var stack: Stack<StackModel>
let leftLabel = Label.createLabelRegularBodySmall(true) public let leftLabel = Label.createLabelRegularBodySmall(true)
let centerLabel = Label.createLabelRegularBodySmall(true) public let centerLabel = Label.createLabelRegularBodySmall(true)
let rightLabel = Label.createLabelRegularBodySmall(true) public let rightLabel = Label.createLabelRegularBodySmall(true)
let arrow = Arrow(frame: .zero) public let arrow = Arrow(frame: .zero)
public let arrowAndLabel2Stack: Stack<StackModel>
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
//----------------------------------------------------- //-----------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
arrowAndLabel2Stack = Stack<StackModel>.createStack(with: [(view: arrow, model: StackItemModel(horizontalAlignment: .fill)),
(view: centerLabel, model: StackItemModel(horizontalAlignment: .leading))],
axis: .horizontal, spacing: 4)
centerLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
centerLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 30, horizontalAlignment: .leading)), stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 30, horizontalAlignment: .leading)),
(view: arrow, model: StackItemModel(percent: 4, horizontalAlignment: .trailing)), (view: arrowAndLabel2Stack, model: StackItemModel(percent: 50, horizontalAlignment: .fill)),
(view: centerLabel, model: StackItemModel(percent: 46, horizontalAlignment: .leading)),
(view: rightLabel, model: StackItemModel(percent:20,horizontalAlignment: .leading))], (view: rightLabel, model: StackItemModel(percent:20,horizontalAlignment: .leading))],
axis: .horizontal,spacing: 2) axis: .horizontal)
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
} }
@ -42,6 +47,8 @@ import Foundation
super.setupView() super.setupView()
addMolecule(stack) addMolecule(stack)
arrow.pinHeightAndWidth() arrow.pinHeightAndWidth()
arrowAndLabel2Stack.restack()
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]?) {
@ -51,7 +58,6 @@ import Foundation
centerLabel.set(with: model.centerLabel, delegateObject, additionalData) centerLabel.set(with: model.centerLabel, delegateObject, additionalData)
rightLabel.set(with: model.rightLabel, delegateObject, additionalData) rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
arrow.set(with: model.arrow, delegateObject, additionalData) arrow.set(with: model.arrow, delegateObject, additionalData)
stack.restack()
} }
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
@ -63,6 +69,5 @@ import Foundation
leftLabel.styleRegularBodySmall(true) leftLabel.styleRegularBodySmall(true)
centerLabel.styleRegularBodySmall(true) centerLabel.styleRegularBodySmall(true)
rightLabel.styleRegularBodySmall(true) rightLabel.styleRegularBodySmall(true)
arrow.reset()
} }
} }

View File

@ -9,7 +9,6 @@
import Foundation import Foundation
public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModelProtocol { public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModelProtocol {
public static var identifier: String = "list3CIntData" public static var identifier: String = "list3CIntData"
public var leftLabel: LabelModel public var leftLabel: LabelModel
public var centerLabel: LabelModel public var centerLabel: LabelModel
@ -24,12 +23,6 @@ public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModel
super.init() super.init()
} }
public override func setDefaults() {
super.setDefaults()
arrow.degrees = 50
arrow.color = Color.init(uiColor: .mvmGreen)
}
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName case moleculeName
case leftLabel case leftLabel
@ -47,7 +40,7 @@ public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModel
try super.init(from: decoder) try super.init(from: decoder)
} }
public override func encode(to encoder: Encoder) throws { public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder) try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)