From 4d4765ccecce20baff5f394665ed96b373090e3b Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 27 Sep 2024 09:03:12 -0500 Subject: [PATCH 1/2] removed duplicate alignment property and updated the confluence to reference the correct textAlignment. Signed-off-by: Matt Bruce --- .../DesignedComponents/LockUps/TitleLockupModel.swift | 9 --------- 1 file changed, 9 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/TitleLockupModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/TitleLockupModel.swift index 97d37598..1899b421 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/TitleLockupModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/TitleLockupModel.swift @@ -26,8 +26,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol { public var titleColor: TitleLockup.TitleTextColor = .primary public var subTitle: LabelModel? public var subTitleColor: TitleLockup.TextColor = .primary - - public var alignment: VDS.TitleLockup.TextAlignment = .left public var inverted: Bool = false public var backgroundColor: Color? @@ -49,7 +47,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol { public func isEqual(to model: any ModelComparisonProtocol) -> Bool { guard let model = model as? Self else { return false } return textAlignment == model.textAlignment - && alignment == model.alignment && titleColor == model.titleColor && subTitleColor == model.subTitleColor && inverted == model.inverted @@ -83,7 +80,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol { case subTitle case subTitleColor case inverted - case alignment } //-------------------------------------------------- @@ -128,10 +124,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol { subTitleColor = .primary } - if let newAlignment = try typeContainer.decodeIfPresent(VDS.TitleLockup.TextAlignment.self, forKey: .alignment) { - alignment = newAlignment - } - if let inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) { self.inverted = inverted } else { @@ -151,7 +143,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol { try container.encode(titleColor, forKey: .titleColor) try container.encodeIfPresent(subTitle, forKey: .subTitle) try container.encode(subTitleColor, forKey: .subTitleColor) - try container.encode(alignment, forKey: .alignment) try container.encode(inverted, forKey: .inverted) } From de33f8ffa133897f82e2f55aa1027d7577f12d98 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 27 Sep 2024 09:38:36 -0500 Subject: [PATCH 2/2] fixed migration issue in checkboxLabel to integrate the VDS.CheckboxItem Signed-off-by: Matt Bruce --- MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift | 14 ++++---------- .../Atomic/Atoms/Views/CheckboxLabelModel.swift | 12 +++++++----- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift index 919cd953..1892c3fb 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift @@ -36,18 +36,12 @@ import VDS updateCheckbox() //primary label - labelText = viewModel.label.text - if let attributes = viewModel.label.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) { - labelTextAttributes = attributes - } + labelText = viewModel.label?.text + labelTextAttributes = viewModel.label?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) //secondary label - if let subTitleModel = viewModel.subTitle { - childText = subTitleModel.text - if let attributes = subTitleModel.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) { - childTextAttributes = attributes - } - } + childText = viewModel.subTitle?.text + childTextAttributes = viewModel.subTitle?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) } private func performCheckboxAction(with actionModel: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { diff --git a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift index fde30ae6..fca5cf31 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift @@ -17,14 +17,16 @@ import VDS public var backgroundColor: Color? public var checkbox: CheckboxModel - public var label: LabelModel + public var label: LabelModel? public var subTitle: LabelModel? public var inverted: Bool? = false public var surface: Surface { inverted ?? false ? .dark : .light } public var children: [MoleculeModelProtocol] { - guard let subTitle else { return [checkbox, label] } - return [checkbox, label, subTitle] + var values: [MoleculeModelProtocol] = [checkbox] + if let label { values.append(label) } + if let subTitle { values.append(subTitle) } + return values } //-------------------------------------------------- @@ -54,8 +56,8 @@ extension Array where Element == CheckboxLabelModel { return compactMap({ model in var item = CheckboxGroup.CheckboxItemModel() item.inputId = model.checkbox.fieldKey - item.labelText = model.label.text - if let attributes = model.label.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) { + item.labelText = model.label?.text + if let attributes = model.label?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) { item.labelTextAttributes = attributes } item.childText = model.subTitle?.text