Skip to content

Commit 2187d84

Browse files
authored
Merge pull request #3 from ServerDriven/develop
Develop
2 parents e457a77 + 1067569 commit 2187d84

File tree

10 files changed

+84
-21
lines changed

10 files changed

+84
-21
lines changed
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
public struct SomeStyle: Codable {
2-
public var backgroundColor: SomeColor?
32
public var isHidden: Bool
3+
public var cornerRadius: Int
4+
5+
public var foregroundColor: SomeColor?
6+
public var backgroundColor: SomeColor?
47

58
public init(
6-
backgroundColor: SomeColor? = nil,
7-
isHidden: Bool = false
9+
isHidden: Bool = false,
10+
cornerRadius: Int = 0,
11+
foregroundColor: SomeColor? = nil,
12+
backgroundColor: SomeColor? = nil
813
) {
9-
self.backgroundColor = backgroundColor
1014
self.isHidden = isHidden
15+
self.cornerRadius = cornerRadius
16+
self.foregroundColor = foregroundColor
17+
self.backgroundColor = backgroundColor
1118
}
1219
}

Sources/ScreenData/Objects/SomeView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ public struct SomeView: Codable {
44
public var container: SomeContainerView?
55
public var someImage: SomeImage?
66
public var someLabel: SomeLabel?
7+
public var someText: SomeText?
8+
public var someButton: SomeButton?
79
public var someLabeledImage: SomeLabeledImage?
810
public var someCustomView: SomeCustomView?
911

@@ -12,13 +14,17 @@ public struct SomeView: Codable {
1214
container: SomeContainerView? = nil,
1315
someImage: SomeImage? = nil,
1416
someLabel: SomeLabel? = nil,
17+
someText: SomeText? = nil,
18+
someButton: SomeButton? = nil,
1519
someLabeledImage: SomeLabeledImage? = nil,
1620
someCustomView: SomeCustomView? = nil
1721
) {
1822
self.type = type
1923
self.container = container
2024
self.someImage = someImage
2125
self.someLabel = someLabel
26+
self.someText = someText
27+
self.someButton = someButton
2228
self.someLabeledImage = someLabeledImage
2329
self.someCustomView = someCustomView
2430
}
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
public enum ViewType: String, Codable {
2-
case label
3-
case image
4-
case labeledImage
5-
case container
2+
case label
3+
case text
4+
case button
5+
case image
6+
case labeledImage
7+
case container
68
case custom
79
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
public struct SomeButton: Codable {
2+
public var id: String?
3+
4+
public var title: String
5+
6+
public var actionID: String?
7+
public var destination: Destination?
8+
9+
public var style: SomeStyle?
10+
11+
public var type: ViewType {
12+
.button
13+
}
14+
15+
public init(
16+
id: String? = nil,
17+
title: String,
18+
actionID: String? = nil,
19+
destination: Destination? = nil,
20+
style: SomeStyle? = nil
21+
) {
22+
self.id = id
23+
self.title = title
24+
self.destination = destination
25+
self.style = style
26+
}
27+
}

Sources/ScreenData/Views/SomeContainerView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public struct SomeContainerView: Codable {
1414
id: String? = nil,
1515
axis: ViewDirectionAxis,
1616
views: [SomeView],
17-
style: SomeStyle?
17+
style: SomeStyle? = nil
1818
) {
1919
self.id = id
2020
self.axis = axis

Sources/ScreenData/Views/SomeCustomView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public struct SomeCustomView: Codable {
2020
public init(
2121
id: String? = nil,
2222
title: String,
23-
subtitle: String?,
24-
style: SomeStyle?,
25-
someImage: SomeImage?,
26-
destination: Destination?,
23+
subtitle: String? = nil,
24+
style: SomeStyle? = nil,
25+
someImage: SomeImage? = nil,
26+
destination: Destination? = nil,
2727
axis: ViewDirectionAxis,
2828
views: [SomeView]
2929
) {

Sources/ScreenData/Views/SomeImage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public struct SomeImage: Codable {
1414
public init(
1515
id: String? = nil,
1616
url: String,
17-
style: SomeStyle?,
18-
destination: Destination?
17+
style: SomeStyle? = nil,
18+
destination: Destination? = nil
1919
) {
2020
self.id = id
2121
self.url = url

Sources/ScreenData/Views/SomeLabel.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public struct SomeLabel: Codable {
1515
public init(
1616
id: String? = nil,
1717
title: String,
18-
subtitle: String?,
19-
style: SomeStyle?,
20-
destination: Destination?
18+
subtitle: String? = nil,
19+
style: SomeStyle? = nil,
20+
destination: Destination? = nil
2121
) {
2222
self.id = id
2323
self.title = title

Sources/ScreenData/Views/SomeLabeledImage.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public struct SomeLabeledImage: Codable {
1616
public init(
1717
id: String? = nil,
1818
title: String,
19-
subtitle: String?,
19+
subtitle: String? = nil,
2020
someImage: SomeImage,
21-
style: SomeStyle?,
22-
destination: Destination?
21+
style: SomeStyle? = nil,
22+
destination: Destination? = nil
2323
) {
2424
self.id = id
2525
self.title = title
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
public struct SomeText: Codable {
2+
public var id: String?
3+
4+
public var title: String
5+
6+
public var style: SomeStyle?
7+
8+
public var type: ViewType {
9+
.text
10+
}
11+
12+
public init(
13+
id: String? = nil,
14+
title: String,
15+
style: SomeStyle? = nil
16+
) {
17+
self.id = id
18+
self.title = title
19+
self.style = style
20+
}
21+
}

0 commit comments

Comments
 (0)