Merge branch 'feature/tilet' into 'develop'
added default values in the decoder func See merge request BPHV_MIPS/vds_ios!33
This commit is contained in:
commit
79dfc104fb
@ -20,6 +20,13 @@ extension Tilet {
|
|||||||
self.size = size
|
self.size = size
|
||||||
self.surface = surface
|
self.surface = surface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public init(from decoder: Decoder) throws {
|
||||||
|
let container: KeyedDecodingContainer<Tilet.DescriptiveIcon.CodingKeys> = try decoder.container(keyedBy: Tilet.DescriptiveIcon.CodingKeys.self)
|
||||||
|
self.name = try container.decode(Icon.Name.self, forKey: Tilet.DescriptiveIcon.CodingKeys.name)
|
||||||
|
self.size = try container.decodeIfPresent(Icon.Size.self, forKey: Tilet.DescriptiveIcon.CodingKeys.size) ?? .medium
|
||||||
|
self.surface = try container.decodeIfPresent(Surface.self, forKey: Tilet.DescriptiveIcon.CodingKeys.surface) ?? .dark
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct DirectionalIcon: Codable {
|
public struct DirectionalIcon: Codable {
|
||||||
@ -30,5 +37,11 @@ extension Tilet {
|
|||||||
self.size = size
|
self.size = size
|
||||||
self.surface = surface
|
self.surface = surface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public init(from decoder: Decoder) throws {
|
||||||
|
let container: KeyedDecodingContainer<Tilet.DirectionalIcon.CodingKeys> = try decoder.container(keyedBy: Tilet.DirectionalIcon.CodingKeys.self)
|
||||||
|
self.size = try container.decodeIfPresent(Icon.Size.self, forKey: Tilet.DirectionalIcon.CodingKeys.size) ?? .medium
|
||||||
|
self.surface = try container.decodeIfPresent(Surface.self, forKey: Tilet.DirectionalIcon.CodingKeys.surface) ?? .dark
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,5 +50,12 @@ extension Tilet {
|
|||||||
textColor: textColor,
|
textColor: textColor,
|
||||||
textAttributes: nil)
|
textAttributes: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public init(from decoder: Decoder) throws {
|
||||||
|
let container: KeyedDecodingContainer<Tilet.SubTitleModel.CodingKeys> = try decoder.container(keyedBy: Tilet.SubTitleModel.CodingKeys.self)
|
||||||
|
self.text = try container.decode(String.self, forKey: Tilet.SubTitleModel.CodingKeys.text)
|
||||||
|
self.textStyle = try container.decodeIfPresent(Tilet.SubTitleModel.TextStyle.self, forKey: Tilet.SubTitleModel.CodingKeys.textStyle) ?? .bodySmall
|
||||||
|
self.textColor = try container.decodeIfPresent(Use.self, forKey: Tilet.SubTitleModel.CodingKeys.textColor) ?? .primary
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,5 +48,11 @@ extension Tilet {
|
|||||||
textAttributes: nil,
|
textAttributes: nil,
|
||||||
textStyle: textStyle.value)
|
textStyle: textStyle.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public init(from decoder: Decoder) throws {
|
||||||
|
let container: KeyedDecodingContainer<Tilet.TitleModel.CodingKeys> = try decoder.container(keyedBy: Tilet.TitleModel.CodingKeys.self)
|
||||||
|
self.text = try container.decode(String.self, forKey: Tilet.TitleModel.CodingKeys.text)
|
||||||
|
self.textStyle = try container.decodeIfPresent(Tilet.TitleModel.TextStyle.self, forKey: Tilet.TitleModel.CodingKeys.textStyle) ?? .boldTitleSmall
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user