refactored model to remove default text
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
3d86b8fcf7
commit
eab6fb5f3b
@ -28,8 +28,8 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
|
||||
public var surface: Surface { inverted ? .dark : .light }
|
||||
public var inverted: Bool = false
|
||||
public var showText: Bool = false
|
||||
public var onText: String = "On"
|
||||
public var offText: String = "Off"
|
||||
public var onText: String?
|
||||
public var offText: String?
|
||||
public var textSize: VDS.Toggle.TextSize = .small
|
||||
public var textWeight: VDS.Toggle.TextWeight = .regular
|
||||
public var textPosition: VDS.Toggle.TextPosition = .left
|
||||
@ -126,8 +126,8 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
|
||||
|
||||
inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
||||
showText = try typeContainer.decodeIfPresent(Bool.self, forKey: .showText) ?? false
|
||||
onText = try typeContainer.decodeIfPresent(String.self, forKey: .onText) ?? "On"
|
||||
offText = try typeContainer.decodeIfPresent(String.self, forKey: .offText) ?? "Off"
|
||||
onText = try typeContainer.decodeIfPresent(String.self, forKey: .onText)
|
||||
offText = try typeContainer.decodeIfPresent(String.self, forKey: .offText)
|
||||
textSize = try typeContainer.decodeIfPresent(VDS.Toggle.TextSize.self, forKey: .textSize) ?? .small
|
||||
textWeight = try typeContainer.decodeIfPresent(VDS.Toggle.TextWeight.self, forKey: .textWeight) ?? .regular
|
||||
textPosition = try typeContainer.decodeIfPresent(VDS.Toggle.TextPosition.self, forKey: .textPosition) ?? .left
|
||||
@ -151,8 +151,8 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
|
||||
|
||||
try container.encode(inverted, forKey: .inverted)
|
||||
try container.encode(showText, forKey: .showText)
|
||||
try container.encode(onText, forKey: .onText)
|
||||
try container.encode(offText, forKey: .offText)
|
||||
try container.encodeIfPresent(onText, forKey: .onText)
|
||||
try container.encodeIfPresent(offText, forKey: .offText)
|
||||
try container.encode(textSize, forKey: .textSize)
|
||||
try container.encode(textWeight, forKey: .textWeight)
|
||||
try container.encode(textPosition, forKey: .textPosition)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user