minor cleanup

This commit is contained in:
Pfeil, Scott Robert 2020-04-30 13:00:24 -04:00
parent 0ab732a4f5
commit 5e0d26fe94
2 changed files with 13 additions and 15 deletions

View File

@ -14,8 +14,8 @@ import Foundation
// MARK: - Outlets
//-------------------------------------------------------
let leftDropDown = ItemDropdownEntryField()
let rightDropDown = ItemDropdownEntryField()
public let leftDropDown = ItemDropdownEntryField()
public let rightDropDown = ItemDropdownEntryField()
var stack: Stack<StackModel>
//-------------------------------------------------------
@ -25,7 +25,7 @@ import Foundation
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: leftDropDown, model: StackItemModel(percent: 50, horizontalAlignment: .fill)),
(view: rightDropDown, model: StackItemModel(percent: 50, horizontalAlignment: .fill))],
axis: .horizontal,spacing: 10)
axis: .horizontal, spacing: 9)
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
@ -36,24 +36,20 @@ import Foundation
//-------------------------------------------------------
// MARK: - View Lifecycle
//-------------------------------------------------------
open override func setupView() {
super.setupView()
addMolecule(stack)
stack.restack()
}
//----------------------------------------------------
// MARK: - Molecule
//------------------------------------------------------
override open func reset() {
super.reset()
leftDropDown.reset()
rightDropDown.reset()
}
//----------------------------------------------------
// MARK: - Molecule
//------------------------------------------------------
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}
guard let model = model as? ListTwoColumnDropdownSelectorsModel else { return }
leftDropDown.set(with:model.leftDropDown, delegateObject, additionalData)
rightDropDown.set(with:model.rightDropDown, delegateObject, additionalData)
}

View File

@ -28,13 +28,15 @@ public class ListTwoColumnDropdownSelectorsModel: ListItemModel, MoleculeModelPr
if bottomPadding == nil {
bottomPadding = 0
}
if line == nil {
line = LineModel(type: .none)
}
}
public init(leftDropDown : ItemDropdownEntryFieldModel, rightDropDown: ItemDropdownEntryFieldModel){
public init(leftDropDown: ItemDropdownEntryFieldModel, rightDropDown: ItemDropdownEntryFieldModel) {
self.leftDropDown = leftDropDown
self.rightDropDown = rightDropDown
super.init()
setDefaults()
}
private enum CodingKeys: String, CodingKey {
@ -53,7 +55,7 @@ public class ListTwoColumnDropdownSelectorsModel: ListItemModel, MoleculeModelPr
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(ListTwoColumnDropdownSelectorsModel.identifier, forKey: .moleculeName)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(leftDropDown, forKey: .leftDropDown)
try container.encode(rightDropDown, forKey: .rightDropDown)
}