File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Sources/LiveViewNative/Utils Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ extension Axis.Set: Decodable, AttributeDecodable {
2121 if let alignment = Self ( string: string) {
2222 self = alignment
2323 } else {
24- throw DecodingError . dataCorrupted ( . init( codingPath: container. codingPath, debugDescription: " expected valid value for HorizontalAlignment " ) )
24+ throw DecodingError . dataCorrupted ( . init( codingPath: container. codingPath, debugDescription: " expected valid value for Axis.Set " ) )
2525 }
2626 }
2727
@@ -44,3 +44,22 @@ extension Axis.Set: Decodable, AttributeDecodable {
4444 self = result
4545 }
4646}
47+
48+ /// A horizontal or vertical dimension.
49+ ///
50+ /// Possible values:
51+ /// * `horizontal`
52+ /// * `vertical`
53+ extension Axis : Decodable {
54+ public init ( from decoder: Decoder ) throws {
55+ let container = try decoder. singleValueContainer ( )
56+ switch try container. decode ( String . self) {
57+ case " horizontal " :
58+ self = . horizontal
59+ case " vertical " :
60+ self = . vertical
61+ default :
62+ throw DecodingError . dataCorrupted ( . init( codingPath: container. codingPath, debugDescription: " expected valid value for Axis " ) )
63+ }
64+ }
65+ }
You can’t perform that action at this time.
0 commit comments