code improvements
This commit is contained in:
parent
3f1e37c878
commit
ae62d161fd
@ -795,6 +795,8 @@
|
||||
children = (
|
||||
AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */,
|
||||
AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */,
|
||||
C7F8012223E846C300396FBD /* ListRVWheelModel.swift */,
|
||||
C7F8012023E8303200396FBD /* ListRVWheel.swift */,
|
||||
);
|
||||
path = RightVariable;
|
||||
sourceTree = "<group>";
|
||||
@ -903,8 +905,6 @@
|
||||
C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */,
|
||||
D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */,
|
||||
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
||||
C7F8012223E846C300396FBD /* ListRVWheelModel.swift */,
|
||||
C7F8012023E8303200396FBD /* ListRVWheel.swift */,
|
||||
);
|
||||
path = VerticalCombinationViews;
|
||||
sourceTree = "<group>";
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@objcMembers public class ListRVWheel: TableViewCell {
|
||||
|
||||
@objcMembers open class ListRVWheel: TableViewCell {
|
||||
let wheel = GraphView(frame: .zero)
|
||||
let leftLabel = Label(frame: .zero)
|
||||
let rightLabel = Label(frame: .zero)
|
||||
let leftLabel = Label.commonLabelB1(true)
|
||||
let rightLabel = Label.commonLabelB2(true)
|
||||
let stack = Stack<StackModel>(frame: .zero)
|
||||
|
||||
//-------------------------------------------------
|
||||
// MARK: - View Cycle
|
||||
//-------------------------------------------------
|
||||
@ -26,13 +26,15 @@ import Foundation
|
||||
//-------------------------------------------------
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||
stack.translatesAutoresizingMaskIntoConstraints = false
|
||||
stack.stackItems = [StackItem(andContain: leftLabel),StackItem(andContain: wheel),StackItem(andContain: rightLabel)]
|
||||
contentView.addSubview(stack)
|
||||
containerHelper.constrainView(stack)
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
// MARK: - ModelMoleculeViewProtocol
|
||||
//-------------------------------------------------
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
@ -42,14 +44,14 @@ import Foundation
|
||||
wheel.setWithModel(model.wheel, delegateObject, additionalData)
|
||||
|
||||
// Create a stack model to use for the internal stack and set the alignment of models
|
||||
let leftHeadlineBodyAlignment = StackItemModel(percent: 55)
|
||||
leftHeadlineBodyAlignment.horizontalAlignment = .leading
|
||||
|
||||
let centerHeadLineBodyAlignment = StackItemModel(percent: 20)
|
||||
centerHeadLineBodyAlignment.horizontalAlignment = .trailing
|
||||
let rightHeadLineBodyAlignment = StackItemModel(percent: 25)
|
||||
rightHeadLineBodyAlignment.horizontalAlignment = .trailing
|
||||
let stackModel = StackModel(molecules: [leftHeadlineBodyAlignment,centerHeadLineBodyAlignment,rightHeadLineBodyAlignment])
|
||||
let leftLabelStackItem = StackItemModel()
|
||||
leftLabelStackItem.horizontalAlignment = .leading
|
||||
let wheelStackItem = StackItemModel()
|
||||
wheelStackItem.horizontalAlignment = .fill
|
||||
let rightLabelStackItem = StackItemModel()
|
||||
rightLabelStackItem.horizontalAlignment = .fill
|
||||
rightLabelStackItem.spacing = 4
|
||||
let stackModel = StackModel(molecules: [leftLabelStackItem,wheelStackItem,rightLabelStackItem])
|
||||
stackModel.axis = .horizontal
|
||||
stack.model = stackModel
|
||||
stack.restack()
|
||||
@ -61,8 +63,11 @@ import Foundation
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
stack.reset()
|
||||
leftLabel.styleB1(true)
|
||||
rightLabel.styleB2(true)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 43
|
||||
return 70
|
||||
}
|
||||
}
|
||||
@ -7,19 +7,20 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
public class ListRVWheelModel:ListItemModel,MoleculeModelProtocol {
|
||||
public class ListRVWheelModel: ListItemModel, MoleculeModelProtocol {
|
||||
public static var identifier: String = "listRVWheel"
|
||||
public var leftLabel: LabelModel?
|
||||
public var rightLabel: LabelModel?
|
||||
public var wheel : CircleProgressModel?
|
||||
init(leftLabel: LabelModel, rightLabel: LabelModel, wheel: CircleProgressModel) {
|
||||
public var leftLabel: LabelModel
|
||||
public var rightLabel: LabelModel
|
||||
public var wheel : CircleProgressModel
|
||||
|
||||
public init(leftLabel: LabelModel, rightLabel: LabelModel, wheel: CircleProgressModel) {
|
||||
self.leftLabel = leftLabel
|
||||
self.rightLabel = rightLabel
|
||||
self.wheel = wheel
|
||||
super.init()
|
||||
}
|
||||
|
||||
private enum CodingKeys: String,CodingKey {
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case leftLabel
|
||||
case rightLabel
|
||||
@ -37,7 +38,7 @@ public class ListRVWheelModel:ListItemModel,MoleculeModelProtocol {
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(ListRVWheelModel.identifier, forKey: .moleculeName)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(leftLabel, forKey: .leftLabel)
|
||||
try container.encode(rightLabel, forKey: .rightLabel)
|
||||
try container.encode(wheel, forKey: .wheel)
|
||||
Loading…
Reference in New Issue
Block a user