changed implementation
This commit is contained in:
parent
f138c0a256
commit
7e2e974f15
@ -13,24 +13,22 @@ import Foundation
|
||||
//-----------------------------------------------------
|
||||
// MARK: - Outlets
|
||||
//-----------------------------------------------------
|
||||
open var stack: Stack<StackModel>
|
||||
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
|
||||
public let rightLabel = Label.commonLabelB2(true)
|
||||
public let arrow = Arrow(frame: .zero)
|
||||
public let arrowAndLabel2Stack: Stack<StackModel>
|
||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
||||
|
||||
//-----------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//-----------------------------------------------------
|
||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
arrowAndLabel2Stack = Stack<StackModel>.createStack(with: [(view: arrow, model: StackItemModel(horizontalAlignment: .trailing)),
|
||||
(view: rightLabel, model: StackItemModel(horizontalAlignment: .fill))],
|
||||
axis: .horizontal, spacing: 6)
|
||||
(view: rightLabel, model: StackItemModel(horizontalAlignment: .trailing))],
|
||||
axis: .horizontal, spacing: 8)
|
||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||
stack = Stack<StackModel>.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(percent: 70, horizontalAlignment: .leading)),
|
||||
(view: arrowAndLabel2Stack, model: StackItemModel(percent: 30, horizontalAlignment: .fill, verticalAlignment: .top))],
|
||||
axis: .horizontal)
|
||||
rightLabel.numberOfLines = 1
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
}
|
||||
|
||||
@ -41,12 +39,30 @@ import Foundation
|
||||
//-----------------------------------------------------
|
||||
// MARK: - View Lifecycle
|
||||
//-----------------------------------------------------
|
||||
|
||||
override open func setupView() {
|
||||
super.setupView()
|
||||
addMolecule(stack)
|
||||
arrow.pinHeightAndWidth()
|
||||
arrowAndLabel2Stack.restack()
|
||||
stack.restack()
|
||||
|
||||
view.addSubview(eyebrowHeadlineBodyLink)
|
||||
view.addSubview(arrowAndLabel2Stack)
|
||||
contentView.addSubview(view)
|
||||
containerHelper.constrainView(view)
|
||||
|
||||
//constraints
|
||||
arrowAndLabel2Stack.leadingAnchor.constraint(equalTo: eyebrowHeadlineBodyLink.trailingAnchor, constant: PaddingTen).isActive = true
|
||||
arrowAndLabel2Stack.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
|
||||
arrowAndLabel2Stack.topAnchor.constraint(equalTo: view.topAnchor, constant: PaddingTwo).isActive = true
|
||||
|
||||
eyebrowHeadlineBodyLink.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
|
||||
eyebrowHeadlineBodyLink.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
|
||||
eyebrowHeadlineBodyLink.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
|
||||
}
|
||||
|
||||
public override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
eyebrowHeadlineBodyLink.updateView(size)
|
||||
}
|
||||
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
|
||||
@ -22,13 +22,6 @@ public class ListRightVariablePriceChangeAllTextAndLinksModel: ListItemModel, Mo
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func setDefaults() {
|
||||
super.setDefaults()
|
||||
if let headline = eyebrowHeadlineBodyLink.headline {
|
||||
headline.hero = 0
|
||||
}
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case eyebrowHeadlineBodyLink
|
||||
|
||||
Loading…
Reference in New Issue
Block a user