From 7e2e974f15b68c88a531da72c6c05ff140834bb9 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Fri, 17 Apr 2020 13:06:19 +0530 Subject: [PATCH] changed implementation --- ...htVariablePriceChangeAllTextAndLinks.swift | 32 ++++++++++++++----- ...iablePriceChangeAllTextAndLinksModel.swift | 7 ---- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index 6d179922..7355d17c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -13,24 +13,22 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- - open var stack: Stack public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) public let rightLabel = Label.commonLabelB2(true) public let arrow = Arrow(frame: .zero) public let arrowAndLabel2Stack: Stack + let view = MVMCoreUICommonViewsUtility.commonView() //----------------------------------------------------- // MARK: - Initializers //----------------------------------------------------- public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { arrowAndLabel2Stack = Stack.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.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]?) { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinksModel.swift index c0f749e2..c048c973 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinksModel.swift @@ -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