diff --git a/MVMCoreUI/Atoms/Views/CheckboxLabelModel.swift b/MVMCoreUI/Atoms/Views/CheckboxLabelModel.swift index 088f7d9e..79d2ecb3 100644 --- a/MVMCoreUI/Atoms/Views/CheckboxLabelModel.swift +++ b/MVMCoreUI/Atoms/Views/CheckboxLabelModel.swift @@ -8,11 +8,17 @@ import Foundation +public enum CheckboxPosition: String, Codable { + case center + case top + case bottom +} + @objcMembers public class CheckboxLabelModel: MoleculeModelProtocol { public static var identifier: String = "checkboxLabel" public var backgroundColor: Color? - public var checkboxAlignment: String? + public var checkboxAlignment: CheckboxPosition? public var checkbox: CheckboxModel public var label: LabelModel @@ -24,7 +30,7 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - self.checkboxAlignment = try typeContainer.decodeIfPresent(String.self, forKey: .checkboxAlignment) + self.checkboxAlignment = try typeContainer.decodeIfPresent(CheckboxPosition.self, forKey: .checkboxAlignment) self.checkbox = try typeContainer.decode(CheckboxModel.self, forKey: .checkbox) self.label = try typeContainer.decode(LabelModel.self, forKey: .label) } diff --git a/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift b/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift index 69141210..1e0c5590 100644 --- a/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift +++ b/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift @@ -21,12 +21,6 @@ public var checkboxPosition: CheckboxPosition = .center - public enum CheckboxPosition: String { - case center - case top - case bottom - } - //-------------------------------------------------- // MARK: - Constraints //-------------------------------------------------- @@ -126,8 +120,8 @@ return } - if let checkboxAlignment = checkBoxWithLabelModel.checkboxAlignment, let position = CheckboxPosition(rawValue: checkboxAlignment) { - alignCheckbox(position) + if let checkboxAlignment = checkBoxWithLabelModel.checkboxAlignment { + alignCheckbox(checkboxAlignment) } checkbox.setWithModel(checkBoxWithLabelModel.checkbox, delegateObject, additionalData)