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?) {
|
||||
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .leading)),
|
||||
(view: bar, model: StackItemModel(horizontalAlignment: .trailing)),
|
||||
(view: rightLabel, model: StackItemModel(horizontalAlignment: .fill))],
|
||||
(view: bar, model: StackItemModel(horizontalAlignment: .fill)),
|
||||
(view: rightLabel, model: StackItemModel(spacing: 4, horizontalAlignment: .fill))],
|
||||
axis: .horizontal)
|
||||
bar.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
}
|
||||
|
||||
@ -41,8 +40,9 @@ import Foundation
|
||||
|
||||
override open func setupView() {
|
||||
super.setupView()
|
||||
rightLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
||||
bar.setStyle(.heavy)
|
||||
bar.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||
addMolecule(stack)
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,6 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
|
||||
case bar
|
||||
}
|
||||
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
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(rightLabel, forKey: .rightLabel)
|
||||
try container.encode(bar, forKey: .bar)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user