From 5dafbe6a8532b8062c10d4e6642280a172abb68d Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Wed, 22 Jan 2020 14:21:48 -0500 Subject: [PATCH] more color --- MVMCoreUI/Atoms/Views/Checkbox.swift | 6 +++--- MVMCoreUI/Atoms/Views/CheckboxModel.swift | 12 ++++++------ .../OtherHandlers/MVMCoreUIMoleculeMappingObject.m | 2 -- MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift | 11 +++++++---- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Checkbox.swift b/MVMCoreUI/Atoms/Views/Checkbox.swift index fe5add9b..6b125e82 100644 --- a/MVMCoreUI/Atoms/Views/Checkbox.swift +++ b/MVMCoreUI/Atoms/Views/Checkbox.swift @@ -478,7 +478,7 @@ import MVMCore } if let borderColorHex = checkboxModel.borderColor { - layer.borderColor = UIColor.mfGet(forHex: borderColorHex).cgColor + layer.borderColor = borderColorHex.uiColor.cgColor } if let borderWidth = checkboxModel.borderWidth { @@ -496,11 +496,11 @@ import MVMCore } if let unCheckedBackgroundColorHex = checkboxModel.unCheckedBackgroundColor { - unCheckedBackgroundColor = UIColor.mfGet(forHex: unCheckedBackgroundColorHex) + unCheckedBackgroundColor = unCheckedBackgroundColorHex.uiColor } if let checkedBackgroundColorHex = checkboxModel.checkedBackgroundColor { - checkedBackgroundColor = UIColor.mfGet(forHex: checkedBackgroundColorHex) + checkedBackgroundColor = checkedBackgroundColorHex.uiColor } if let isAnimated = checkboxModel.isAnimated { diff --git a/MVMCoreUI/Atoms/Views/CheckboxModel.swift b/MVMCoreUI/Atoms/Views/CheckboxModel.swift index 4b854951..72c6dbfd 100644 --- a/MVMCoreUI/Atoms/Views/CheckboxModel.swift +++ b/MVMCoreUI/Atoms/Views/CheckboxModel.swift @@ -16,12 +16,12 @@ import Foundation public var value: String? public var fieldKey: String? public var required: Bool? - public var borderColor: String? + public var borderColor: Color? public var borderWidth: CGFloat? public var isChecked: Bool = false public var checkColor: Color? - public var unCheckedBackgroundColor: String? - public var checkedBackgroundColor: String? + public var unCheckedBackgroundColor: Color? + public var checkedBackgroundColor: Color? public var isAnimated: Bool? public var isRound: Bool? public var isEnabled: Bool? @@ -51,12 +51,12 @@ import Foundation self.value = try typeContainer.decodeIfPresent(String.self, forKey: .value) self.fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) self.required = try typeContainer.decodeIfPresent(Bool.self, forKey: .required) - self.borderColor = try typeContainer.decodeIfPresent(String.self, forKey: .borderColor) + self.borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) self.borderWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .borderWidth) self.isChecked = try typeContainer.decodeIfPresent(Bool.self, forKey: .isChecked) ?? false self.checkColor = try typeContainer.decodeIfPresent(Color.self, forKey: .checkColor) - self.unCheckedBackgroundColor = try typeContainer.decodeIfPresent(String.self, forKey: .unCheckedBackgroundColor) - self.checkedBackgroundColor = try typeContainer.decodeIfPresent(String.self, forKey: .checkedBackgroundColor) + self.unCheckedBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .unCheckedBackgroundColor) + self.checkedBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .checkedBackgroundColor) self.isAnimated = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAnimated) self.isRound = try typeContainer.decodeIfPresent(Bool.self, forKey: .isRound) self.isEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .isEnabled) diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m index b5a39119..687f3cd9 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m @@ -42,8 +42,6 @@ @"textEntryField": TextEntryField.class, @"itemDropdownEntryField": ItemDropdownEntryField.class, @"dateDropdownEntryField": DateDropdownEntryField.class, - @"checkbox": Checkbox.class, - @"checkboxLabel": CheckboxWithLabelView.class, @"cornerLabels" : CornerLabels.class, @"progressBar": ProgressBar.class, @"circleProgress": GraphView.class, diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 6c623572..0e53282e 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -24,6 +24,13 @@ import Foundation ModelRegistry.register(NumberedListModel.self) mapping?.setObject(NumberedList.self, forKey: NumberedListModel.identifier as NSString) + //Checkbox + ModelRegistry.register(CheckboxModel.self) + mapping?.setObject(Checkbox.self, forKey: CheckboxModel.identifier as NSString) + + ModelRegistry.register(CheckboxLabelModel.self) + mapping?.setObject(CheckboxWithLabelView.self, forKey: CheckboxLabelModel.identifier as NSString) + ModelRegistry.register(LabelModel.self) ModelRegistry.register(HeaderModel.self) ModelRegistry.register(FooterModel.self) @@ -71,9 +78,5 @@ import Foundation ModelRegistry.register(NumberedListModel.self) ModelRegistry.register(UnOrderedListModel.self) ModelRegistry.register(HeadlineBodyToggleModel.self) - - //Checkbox - ModelRegistry.register(CheckboxModel.self) - ModelRegistry.register(CheckboxLabelModel.self) } }