From f3370d6ec6d6384e4426ea710365603cb31d5a31 Mon Sep 17 00:00:00 2001 From: Damodaram Date: Fri, 30 Oct 2020 19:35:33 +0530 Subject: [PATCH] initialisation changes --- ...riableIconWithRightCaretAllTextLinks.swift | 26 +++++++------------ ...eIconWithRightCaretAllTextLinksModel.swift | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift index 2031cdd3..75e8d299 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift @@ -14,24 +14,18 @@ public let leftImage = LoadImageView() public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() public let rightLabel = Label(fontStyle: .RegularBodySmall) - public let rightLabelStackItem: StackItem - public var stack: Stack - //-------------------------------------------------- - // MARK: - Initializers - //-------------------------------------------------- + public lazy var rightLabelStackItem: StackItem = { + return StackItem(andContain: rightLabel) + }() - public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - rightLabelStackItem = StackItem(andContain: rightLabel) - let stackItems = [StackItem(andContain: leftImage), StackItem(andContain: eyebrowHeadlineBodyLink), rightLabelStackItem] - let stackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .fill), StackItemModel(horizontalAlignment: .fill), StackItemModel(horizontalAlignment: .fill)], axis: .horizontal) - stack = Stack(with: stackModel, stackItems: stackItems) - super.init(style: style, reuseIdentifier: reuseIdentifier) - } - - public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } + public lazy var stack: Stack = { + return Stack.createStack(with: [ + (view: leftImage, model: StackItemModel(horizontalAlignment: .fill)), + (view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .fill)), + (view: rightLabelStackItem, model: StackItemModel(horizontalAlignment: .fill,verticalAlignment: .top))], + axis: .horizontal) + }() open override func alignAccessoryToHero() -> CGPoint? { // Ensures that the right label is centered vertically with headline. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinksModel.swift index f83d0c6f..c9138a84 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinksModel.swift @@ -26,7 +26,7 @@ public class ListLeftVariableIconWithRightCaretAllTextLinksModel: ListItemModel, image.width = 30 image.height = 30 } - eyebrowHeadlineBodyLink.headline?.hero = 0 + rightLabel.hero = 0 } //-----------------------------------------------------