added more codables and default codable property wrappers
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
aba99b887b
commit
6c3092a1f6
@ -8,7 +8,11 @@
|
||||
|
||||
import Foundation
|
||||
import VDS
|
||||
import VDSColorTokens
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Codable Extensions
|
||||
//--------------------------------------------------
|
||||
extension Surface: Codable {}
|
||||
extension Badge.FillColor: Codable {}
|
||||
extension Icon.Name: Codable {}
|
||||
@ -20,7 +24,31 @@ extension TextLink.Size: Codable {}
|
||||
extension VDS.Line.Style: Codable {}
|
||||
extension VDS.Line.Orientation: Codable {}
|
||||
extension Use: Codable {}
|
||||
|
||||
extension VDS.Button.Size: RawRepresentableCodable {
|
||||
public static var mapping: [String : VDS.Button.Size] { ["standard": .large, "tiny": .small] }
|
||||
public static var defaultValue: VDS.Button.Size? { nil }
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Decodable Defaults
|
||||
//--------------------------------------------------
|
||||
extension DecodableDefault.Sources {
|
||||
public struct Surface: DecodableDefaultSource {
|
||||
public static var defaultValue: VDS.Surface { .light }
|
||||
}
|
||||
|
||||
public struct IconSize: DecodableDefaultSource {
|
||||
public static var defaultValue: VDS.Icon.Size { .medium }
|
||||
}
|
||||
|
||||
public struct BlackColor: DecodableDefaultSource {
|
||||
public static var defaultValue: Color { .init(uiColor: VDSColor.paletteBlack) }
|
||||
}
|
||||
}
|
||||
|
||||
extension DecodableDefault {
|
||||
public typealias IconSize = Wrapper<Sources.IconSize>
|
||||
public typealias BlackColor = Wrapper<Sources.BlackColor>
|
||||
public typealias Surface = Wrapper<Sources.Surface>
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user