From 46e0c6281f151a8e65caea214af2101baa78d267 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 27 Oct 2020 12:33:56 +0530 Subject: [PATCH] Code changes after review. --- .../List/ListStarRating.swift | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListStarRating.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListStarRating.swift index b1ca1ac4..2e1ec8cb 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListStarRating.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListStarRating.swift @@ -12,26 +12,12 @@ //----------------------------------------------------- public let stars = Stars() public var reviewsCount = Label(fontStyle: .RegularBodySmall) + public lazy var stack: Stack = { + return Stack.createStack(with: [(view: stars, model: StackItemModel(horizontalAlignment: .fill)), + (view: reviewsCount, model: StackItemModel(horizontalAlignment: .leading))], + axis: .horizontal, spacing: Padding.Two) + }() - //----------------------------------------------------- - // MARK: - Properties - //----------------------------------------------------- - public var stack: Stack - - //----------------------------------------------------- - // MARK: - Initializers - //----------------------------------------------------- - public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: stars, model: StackItemModel(horizontalAlignment: .fill)), - (view: reviewsCount, model: StackItemModel(horizontalAlignment: .leading))], - axis: .horizontal, spacing: 8) - super.init(style: style, reuseIdentifier: reuseIdentifier) - } - - public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - //----------------------------------------------------- // MARK: - Lifecycle //----------------------------------------------------- @@ -41,6 +27,11 @@ stack.restack() } + open override func updateView(_ size: CGFloat) { + super.updateView(size) + stack.updateView(size) + } + //---------------------------------------------------- // MARK: - Molecule //----------------------------------------------------