code improvement.
This commit is contained in:
parent
50ef2ff6cc
commit
dcc8cc0167
@ -24,10 +24,9 @@ import Foundation
|
|||||||
|
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .leading)),
|
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .leading)),
|
||||||
(view: bar, model: StackItemModel(horizontalAlignment: .trailing)),
|
(view: bar, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
(view: rightLabel, model: StackItemModel(horizontalAlignment: .fill))],
|
(view: rightLabel, model: StackItemModel(spacing: 4, horizontalAlignment: .fill))],
|
||||||
axis: .horizontal)
|
axis: .horizontal)
|
||||||
bar.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,8 +40,9 @@ import Foundation
|
|||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
rightLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
|
||||||
bar.setStyle(.heavy)
|
bar.setStyle(.heavy)
|
||||||
|
bar.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
||||||
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,6 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
|
|||||||
case bar
|
case bar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
@ -54,6 +53,5 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
|
|||||||
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(bar, forKey: .bar)
|
try container.encode(bar, forKey: .bar)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user