moleculeName NavigationImageButtonModel
This commit is contained in:
parent
ca8a9efe00
commit
2e6fe01b69
@ -10,6 +10,7 @@ import Foundation
|
|||||||
public class NavigationImageButtonModel: NavigationButtonModelProtocol, MoleculeModelProtocol {
|
public class NavigationImageButtonModel: NavigationButtonModelProtocol, MoleculeModelProtocol {
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public static var identifier: String = "navigationImageButton"
|
public static var identifier: String = "navigationImageButton"
|
||||||
|
public var moleculeName: String = NavigationImageButtonModel.identifier
|
||||||
|
|
||||||
public var image: String
|
public var image: String
|
||||||
public var action: ActionModelProtocol
|
public var action: ActionModelProtocol
|
||||||
@ -17,11 +18,13 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
|
|||||||
public init(with image: String, action: ActionModelProtocol) {
|
public init(with image: String, action: ActionModelProtocol) {
|
||||||
self.image = image
|
self.image = image
|
||||||
self.action = action
|
self.action = action
|
||||||
|
self.moleculeName = NavigationImageButtonModel.identifier
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case image
|
case image
|
||||||
case action
|
case action
|
||||||
|
case moleculeName
|
||||||
}
|
}
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
@ -33,6 +36,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
|
|||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(image, forKey: .image)
|
try container.encode(image, forKey: .image)
|
||||||
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeModel(action, forKey: .action)
|
try container.encodeModel(action, forKey: .action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user