container change footer
This commit is contained in:
parent
7fb22648c0
commit
826cb7f284
@ -9,33 +9,23 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
@objcMembers public class FooterModel: ContainerMoleculeProtocol {
|
@objcMembers public class FooterModel: MoleculeContainerModel, MoleculeProtocol {
|
||||||
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 init(molecule: MoleculeProtocol){
|
enum FooterCodingKeys: String, CodingKey {
|
||||||
self.molecule = molecule
|
|
||||||
}
|
|
||||||
|
|
||||||
enum CodingKeys: String, CodingKey {
|
|
||||||
case moleculeName
|
|
||||||
case molecule
|
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
}
|
}
|
||||||
|
|
||||||
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: FooterCodingKeys.self)
|
||||||
self.moleculeName = try typeContainer.decode(String.self, forKey: .moleculeName)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
self.backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
try super.init(from: decoder)
|
||||||
self.molecule = try typeContainer.decodeMolecule(codingKey: .molecule)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public override func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
try super.encode(to: encoder)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
var container = encoder.container(keyedBy: FooterCodingKeys.self)
|
||||||
try container.encodeIfPresent(self.backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeModel(self.molecule, forKey: .moleculeName)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user