diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/ListThreeColumnPlanDataDivider.swift b/MVMCoreUI/Molecules/HorizontalCombinationViews/ListThreeColumnPlanDataDivider.swift index 9e821f25..84361c9c 100644 --- a/MVMCoreUI/Molecules/HorizontalCombinationViews/ListThreeColumnPlanDataDivider.swift +++ b/MVMCoreUI/Molecules/HorizontalCombinationViews/ListThreeColumnPlanDataDivider.swift @@ -18,7 +18,6 @@ import Foundation // MARK: - MFViewProtocol open override func updateView(_ size: CGFloat) { super.updateView(size) - styleTallDivider() stack.updateView(size) } @@ -42,9 +41,14 @@ import Foundation centerHeadLineBody.setWithModel(model.centerHeadlineBody, delegateObject, additionalData) rightHeadLineBody.setWithModel(model.rightHeadlineBody, delegateObject, additionalData) - // Create a stack model to use for the internal stack. - let stackModel = StackModel(molecules: [StackItemModel(percent: 33),StackItemModel(percent: 33),StackItemModel(percent: 33)]) - stackModel.spacing = 0 + // Create a stack model to use for the internal stack and set the alignment of models + let leftHeadlineBodyAlignment = StackItemModel(percent: 33) + leftHeadlineBodyAlignment.horizontalAlignment = .leading + let centerHeadLineBodyAlignment = StackItemModel(percent: 34) + centerHeadLineBodyAlignment.horizontalAlignment = .center + let rightHeadLineBodyAlignment = StackItemModel(percent: 33) + rightHeadLineBodyAlignment.horizontalAlignment = .trailing + let stackModel = StackModel(molecules: [leftHeadlineBodyAlignment,centerHeadLineBodyAlignment,rightHeadLineBodyAlignment]) stackModel.axis = .horizontal stack.model = stackModel stack.restack() diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/ListThreeColumnPlanDataDividerModel.swift b/MVMCoreUI/Molecules/HorizontalCombinationViews/ListThreeColumnPlanDataDividerModel.swift index 0da1499d..d03d8528 100644 --- a/MVMCoreUI/Molecules/HorizontalCombinationViews/ListThreeColumnPlanDataDividerModel.swift +++ b/MVMCoreUI/Molecules/HorizontalCombinationViews/ListThreeColumnPlanDataDividerModel.swift @@ -23,6 +23,17 @@ public class ListThreeColumnPlanDataDividerModel: ContainerModel, ListItemModelP self.centerHeadlineBody = centerHeadlineBody self.rightHeadlineBody = rightHeadlineBody super.init() + setDefaults() + } + + /// Defaults to set + func setDefaults() { + if useHorizontalMargins == nil { + useHorizontalMargins = true + } + if useVerticalMargins == nil { + useVerticalMargins = true + } } private enum CodingKeys: String, CodingKey { @@ -38,6 +49,7 @@ public class ListThreeColumnPlanDataDividerModel: ContainerModel, ListItemModelP centerHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .centerHeadlineBody) rightHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .rightHeadlineBody) try super.init(from: decoder) + setDefaults() } public override func encode(to encoder: Encoder) throws { diff --git a/MVMCoreUI/Molecules/Items/StackItemModel.swift b/MVMCoreUI/Molecules/Items/StackItemModel.swift index 66c57809..2058353c 100644 --- a/MVMCoreUI/Molecules/Items/StackItemModel.swift +++ b/MVMCoreUI/Molecules/Items/StackItemModel.swift @@ -8,7 +8,7 @@ import Foundation -@objcMembers public class StackItemModel: StackItemModelProtocol, MoleculeModelProtocol { +@objcMembers public class StackItemModel: ContainerModel, StackItemModelProtocol, MoleculeModelProtocol { public static var identifier: String = "simpleStackItem" public var backgroundColor: Color? public var spacing: CGFloat?