@@ -2,6 +2,10 @@ import SwiftUI
2
2
3
3
public struct StyleProps : Decodable {
4
4
// ViewStyle
5
+ public var color : Color ? // alias for foregroundColor
6
+ public var accentColor : Color ?
7
+ public var tintColor : Color ?
8
+ public var foregroundColor : Color ?
5
9
public var backgroundColor : Color ?
6
10
// - Frame
7
11
public var width : Size ?
@@ -30,21 +34,23 @@ public struct StyleProps: Decodable {
30
34
public var borderRadius : CGFloat ?
31
35
public var cornerRadius : CGFloat ?
32
36
// TextStyle
33
- public var color : Color ? // alias for foregroundColor
34
- public var foregroundColor : Color ?
35
37
public var fontWeight : Font . Weight ?
36
38
public var fontSize : CGFloat ?
37
39
public var font : Font ?
38
40
public var fontFamily : String ?
39
41
40
42
enum CodingKeys : String , CodingKey {
41
- case color, backgroundColor, foregroundColor, width, minWidth, maxWidth, height, minHeight, maxHeight, position, top, left, bottom, right, padding, paddingHorizontal, paddingVertical, paddingLeft, paddingRight, paddingTop, paddingBottom, borderColor, borderWidth, borderRadius, cornerRadius, fontWeight, fontSize, font, fontFamily
43
+ case color, accentColor , tintColor , backgroundColor, foregroundColor, width, minWidth, maxWidth, height, minHeight, maxHeight, position, top, left, bottom, right, padding, paddingHorizontal, paddingVertical, paddingLeft, paddingRight, paddingTop, paddingBottom, borderColor, borderWidth, borderRadius, cornerRadius, fontWeight, fontSize, font, fontFamily
42
44
}
43
45
44
46
public init ( from decoder: Decoder ) throws {
45
47
let container = try decoder. container ( keyedBy: CodingKeys . self)
46
48
47
49
// ViewStyle
50
+ color = try container. decodeColorIfPresent ( forKey: . color) // alias for foregroundColor
51
+ accentColor = try container. decodeColorIfPresent ( forKey: . accentColor)
52
+ tintColor = try container. decodeColorIfPresent ( forKey: . tintColor)
53
+ foregroundColor = try container. decodeColorIfPresent ( forKey: . foregroundColor)
48
54
backgroundColor = try container. decodeColorIfPresent ( forKey: . backgroundColor)
49
55
// - Frame
50
56
width = try container. decodeIfPresent ( Size . self, forKey: . width)
@@ -74,8 +80,6 @@ public struct StyleProps: Decodable {
74
80
cornerRadius = try container. decodeIfPresent ( CGFloat . self, forKey: . cornerRadius)
75
81
76
82
// TextStyle
77
- color = try container. decodeColorIfPresent ( forKey: . color) // alias for foregroundColor
78
- foregroundColor = try container. decodeColorIfPresent ( forKey: . foregroundColor)
79
83
fontWeight = try container. decodeFontWeightIfPresent ( forKey: . fontWeight)
80
84
fontSize = try container. decodeIfPresent ( CGFloat . self, forKey: . fontSize)
81
85
font = try container. decodeFontIfPresent ( forKey: . font)
0 commit comments