From cb53c28e372eefac253f6fcff12d19f3e64d9ce7 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 9 Jun 2020 10:43:18 -0400 Subject: [PATCH] match android --- .../Atomic/Templates/MoleculeStackTemplate.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift b/MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift index 41619142..2bb5ec31 100644 --- a/MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift +++ b/MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift @@ -50,15 +50,15 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol { } open override func viewForMiddle() -> UIView? { + guard let moleculeStackModel = templateModel?.moleculeStack else { return nil } - guard let moleculeStackModel = templateModel?.moleculeStack else { - return nil - } - + // By default: Stack template stack has vertical space before the first item, dynamic stack items have default horizontal padding. let stack = MoleculeStackView(frame: .zero) moleculeStackModel.useStackSpacingBeforeFirstItem = true - if moleculeStackModel.useHorizontalMargins == nil { - moleculeStackModel.useHorizontalMargins = true + for stackItem in moleculeStackModel.molecules { + guard let stackItem = stackItem as? MoleculeStackItemModel, + stackItem.horizontalAlignment == nil else { continue } + stackItem.useHorizontalMargins = true } stack.set(with: moleculeStackModel, delegateObject() as? MVMCoreUIDelegateObject, nil) return stack