forgot to add back in animated to the model

accessibilityIdentifier isn't even used in the current Toggle today

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-10-24 11:51:08 -05:00
parent c075323ce7
commit e27fa862d5

View File

@ -18,6 +18,7 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
public var selected: Bool = false
public var enabled: Bool = true
public var readOnly: Bool = false
public var animated: Bool = false
public var action: ActionModelProtocol?
public var alternateAction: ActionModelProtocol?
public var accessibilityText: String?
@ -34,8 +35,8 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
case state
case enabled
case readOnly
case animated
case action
case accessibilityIdentifier
case alternateAction
case accessibilityText
case fieldKey
@ -87,13 +88,12 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
}
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
readOnly = try typeContainer.decodeIfPresent(Bool.self, forKey: .readOnly) ?? false
animated = try typeContainer.decodeIfPresent(Bool.self, forKey: .animated) ?? false
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeModelIfPresent(action, forKey: .action)
try container.encodeModelIfPresent(alternateAction, forKey: .alternateAction)
try container.encode(moleculeName, forKey: .moleculeName)
@ -102,5 +102,6 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
try container.encodeIfPresent(groupName, forKey: .groupName)
try container.encode(readOnly, forKey: .readOnly)
try container.encode(animated, forKey: .animated)
}
}