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
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)
}

View File

@ -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)