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