model changes
This commit is contained in:
parent
e310a2b74e
commit
c8f8f8136d
@ -14,4 +14,9 @@ import Foundation
|
|||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var label: String
|
public var label: String
|
||||||
public var options: [String]
|
public var options: [String]
|
||||||
|
|
||||||
|
public init(label: String, options: [String]) {
|
||||||
|
self.label = label
|
||||||
|
self.options = options
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import Foundation
|
|||||||
|
|
||||||
@objcMembers public class FooterModel: ContainerMoleculeProtocol {
|
@objcMembers public class FooterModel: ContainerMoleculeProtocol {
|
||||||
public static var identifier: String = "footer"
|
public static var identifier: String = "footer"
|
||||||
public var moleculeName: String?
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var molecule: MoleculeProtocol
|
public var molecule: MoleculeProtocol
|
||||||
|
|
||||||
@ -27,7 +26,6 @@ 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.moleculeName = try typeContainer.decode(String.self, forKey: .moleculeName)
|
|
||||||
self.backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
self.backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
self.molecule = try typeContainer.decodeMolecule(codingKey: .molecule)
|
self.molecule = try typeContainer.decodeMolecule(codingKey: .molecule)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,19 +10,18 @@ import Foundation
|
|||||||
|
|
||||||
@objcMembers public class HeaderModel: MoleculeContainerModel, MoleculeProtocol {
|
@objcMembers public class HeaderModel: MoleculeContainerModel, MoleculeProtocol {
|
||||||
public static var identifier: String = "header"
|
public static var identifier: String = "header"
|
||||||
public var moleculeName: String?
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var line: LineModel?
|
public var line: LineModel?
|
||||||
|
|
||||||
enum HeaderCodingKeys: String, CodingKey {
|
enum HeaderCodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case line
|
case line
|
||||||
|
case backgroundColor
|
||||||
}
|
}
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
try super.init(from: decoder)
|
try super.init(from: decoder)
|
||||||
let typeContainer = try decoder.container(keyedBy: HeaderCodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: HeaderCodingKeys.self)
|
||||||
moleculeName = try typeContainer.decode(String.self, forKey: .moleculeName)
|
|
||||||
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
||||||
|
|
||||||
// Default Values
|
// Default Values
|
||||||
@ -39,5 +38,6 @@ import Foundation
|
|||||||
var container = encoder.container(keyedBy: HeaderCodingKeys.self)
|
var container = encoder.container(keyedBy: HeaderCodingKeys.self)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(line, forKey: .line)
|
try container.encode(line, forKey: .line)
|
||||||
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,10 @@ open class ModuleMoleculeModel: MoleculeProtocol {
|
|||||||
case moduleName
|
case moduleName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public init(_ moduleName: String) {
|
||||||
|
self.moduleName = moduleName
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
moduleName = try typeContainer.decode(String.self, forKey:.moduleName)
|
moduleName = try typeContainer.decode(String.self, forKey:.moduleName)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user