moleculeName for encode

This commit is contained in:
Suresh, Kamlesh 2020-07-14 21:24:16 -04:00
parent adb4ac1893
commit ef5e04de10

View File

@ -11,16 +11,19 @@ import Foundation
public class NavigationLabelButtonModel: NavigationButtonModelProtocol, MoleculeModelProtocol {
public var backgroundColor: Color?
public static var identifier: String = "navigationLabelButton"
public var moleculeName: String = NavigationLabelButtonModel.identifier
public var title: String
public var action: ActionModelProtocol
public init(with title: String, action: ActionModelProtocol) {
self.moleculeName = NavigationLabelButtonModel.identifier
self.title = title
self.action = action
}
private enum CodingKeys: String, CodingKey {
case moleculeName
case title
case action
}
@ -33,6 +36,7 @@ public class NavigationLabelButtonModel: NavigationButtonModelProtocol, Molecule
open func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(title, forKey: .title)
try container.encodeModel(action, forKey: .action)
}