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