From 86f397434c82eab32deb6b882f3df95fac56e80d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 12 Jan 2021 12:36:22 -0500 Subject: [PATCH 1/2] convenience function for uistackview --- MVMCoreUI/Categories/UIStackView+Extension.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MVMCoreUI/Categories/UIStackView+Extension.swift b/MVMCoreUI/Categories/UIStackView+Extension.swift index b88dfb51..227f057d 100644 --- a/MVMCoreUI/Categories/UIStackView+Extension.swift +++ b/MVMCoreUI/Categories/UIStackView+Extension.swift @@ -14,6 +14,18 @@ extension UIStackView: MVMCoreViewProtocol { (view as? MVMCoreViewProtocol)?.updateView(size) } } + + /// A convenience function for updating molecules. If model is nil, view is hidden. + open func updateContainedMolecules(with models: [MoleculeModelProtocol?], _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + for (index, item) in arrangedSubviews.enumerated() { + if let model = models[index] { + (item as? MoleculeViewProtocol)?.set(with: model, delegateObject, additionalData) + item.isHidden = false + } else { + item.isHidden = true + } + } + } } extension UIStackView: MoleculeViewProtocol { @@ -23,3 +35,4 @@ extension UIStackView: MoleculeViewProtocol { } } } + From 2d2cc92802313dc7d793d5d7226dc7f64c88f138 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 12 Jan 2021 12:58:32 -0500 Subject: [PATCH 2/2] minor ui bugfixes --- .../ListLeftVariableIconWithRightCaretAllTextLinks.swift | 2 +- .../ListLeftVariableIconWithRightCaretBodyText.swift | 2 +- .../ListRightVariableRightCaretAlltextAndLinks.swift | 2 +- MVMCoreUI/Categories/UIStackView+Extension.swift | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift index d6175136..93d1526f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift @@ -11,7 +11,7 @@ // MARK: - Outlets //-------------------------------------------------- - public let leftImage = LoadImageView() + public let leftImage = LoadImageView(pinnedEdges: .all) public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() public let rightLabel = Label(fontStyle: .RegularBodySmall) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index 4685cafd..b9e4a3e1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -12,7 +12,7 @@ // MARK: - Outlets //-------------------------------------------------- - public let leftImage = LoadImageView() + public let leftImage = LoadImageView(pinnedEdges: .all) public let headlineBody = HeadlineBody() public let rightLabel = Label(fontStyle: .RegularBodySmall) public let rightLabelStackItem: StackItem diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index b05098d4..1fbbe114 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -21,7 +21,7 @@ //-------------------------------------------------- public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill))], axis: .horizontal) + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .leading)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/MVMCoreUI/Categories/UIStackView+Extension.swift b/MVMCoreUI/Categories/UIStackView+Extension.swift index 227f057d..b6bc1b05 100644 --- a/MVMCoreUI/Categories/UIStackView+Extension.swift +++ b/MVMCoreUI/Categories/UIStackView+Extension.swift @@ -25,6 +25,7 @@ extension UIStackView: MVMCoreViewProtocol { item.isHidden = true } } + layoutIfNeeded() } }