This commit is contained in:
Suresh, Kamlesh 2020-01-22 15:15:13 -05:00
parent 61edfcc747
commit 50f573688f
2 changed files with 10 additions and 10 deletions

View File

@ -8,11 +8,17 @@
import Foundation import Foundation
public enum CheckboxPosition: String, Codable {
case center
case top
case bottom
}
@objcMembers public class CheckboxLabelModel: MoleculeModelProtocol { @objcMembers public class CheckboxLabelModel: MoleculeModelProtocol {
public static var identifier: String = "checkboxLabel" public static var identifier: String = "checkboxLabel"
public var backgroundColor: Color? public var backgroundColor: Color?
public var checkboxAlignment: String? public var checkboxAlignment: CheckboxPosition?
public var checkbox: CheckboxModel public var checkbox: CheckboxModel
public var label: LabelModel public var label: LabelModel
@ -24,7 +30,7 @@ import Foundation
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) 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.checkbox = try typeContainer.decode(CheckboxModel.self, forKey: .checkbox)
self.label = try typeContainer.decode(LabelModel.self, forKey: .label) self.label = try typeContainer.decode(LabelModel.self, forKey: .label)
} }

View File

@ -21,12 +21,6 @@
public var checkboxPosition: CheckboxPosition = .center public var checkboxPosition: CheckboxPosition = .center
public enum CheckboxPosition: String {
case center
case top
case bottom
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Constraints // MARK: - Constraints
//-------------------------------------------------- //--------------------------------------------------
@ -126,8 +120,8 @@
return return
} }
if let checkboxAlignment = checkBoxWithLabelModel.checkboxAlignment, let position = CheckboxPosition(rawValue: checkboxAlignment) { if let checkboxAlignment = checkBoxWithLabelModel.checkboxAlignment {
alignCheckbox(position) alignCheckbox(checkboxAlignment)
} }
checkbox.setWithModel(checkBoxWithLabelModel.checkbox, delegateObject, additionalData) checkbox.setWithModel(checkBoxWithLabelModel.checkbox, delegateObject, additionalData)