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 b88dfb51..b6bc1b05 100644 --- a/MVMCoreUI/Categories/UIStackView+Extension.swift +++ b/MVMCoreUI/Categories/UIStackView+Extension.swift @@ -14,6 +14,19 @@ 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 + } + } + layoutIfNeeded() + } } extension UIStackView: MoleculeViewProtocol { @@ -23,3 +36,4 @@ extension UIStackView: MoleculeViewProtocol { } } } +