You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,8 @@ struct PeopleView: View {
80
80
vSpacing: 50,
81
81
hSpacing: 20,
82
82
vPadding: 100,
83
-
hPadding: 20) { person in
83
+
hPadding: 20,
84
+
scrollDirection: .horizontal) { person in
84
85
GridCell(person: person)
85
86
}
86
87
}
@@ -130,7 +131,6 @@ struct PeopleView: View {
130
131
Version `0.1.1` of `QGrid ` contains a very limited set of features. It could be extended by implementing the following tasks:
131
132
132
133
☘️ Parameterize spacing&padding configuration depending on the device orientation
133
-
☘️ Add the option to specify scroll direction
134
134
☘️ Add content-only initializer to QGrid struct, without a collection of identified data as argument (As in SwiftUI’s `List`)
135
135
☘️ Add support for other platforms (watchOS)
136
136
☘️ Add `Stack` layout option (as in `UICollectionView`)
@@ -41,7 +42,7 @@ public struct QGrid<Data, Content>: View
41
42
privatelethSpacing:CGFloat
42
43
privateletvPadding:CGFloat
43
44
privatelethPadding:CGFloat
44
-
privateletscrollable:Bool
45
+
privateletscrollDirection:ScrollDirection
45
46
46
47
privateletdata:[Data.Element]
47
48
privateletcontent:(Data.Element)->Content
@@ -59,6 +60,7 @@ public struct QGrid<Data, Content>: View
59
60
/// - hSpacing: Horizontal spacing: The distance between each cell in grid's row. If not provided, the default value will be used.
60
61
/// - vPadding: Vertical padding: The distance between top/bottom edge of the grid and the parent view. If not provided, the default value will be used.
61
62
/// - hPadding: Horizontal padding: The distance between leading/trailing edge of the grid and the parent view. If not provided, the default value will be used.
63
+
/// - scrollDirection: Scrolling direction: The direction of scrolling behaviour. If not provided, the default `.vertical` value will be used.
62
64
/// - content: A closure returning the content of the individual cell
63
65
publicinit(_ data:Data,
64
66
columns:Int,
@@ -67,7 +69,7 @@ public struct QGrid<Data, Content>: View
67
69
hSpacing:CGFloat=10,
68
70
vPadding:CGFloat=10,
69
71
hPadding:CGFloat=10,
70
-
scrollable:Bool=true,
72
+
scrollDirection:ScrollDirection=.vertical,
71
73
content:@escaping(Data.Element)->Content){
72
74
self.data = data.map{ $0 }
73
75
self.content = content
@@ -77,6 +79,7 @@ public struct QGrid<Data, Content>: View
77
79
self.hSpacing = hSpacing
78
80
self.vPadding = vPadding
79
81
self.hPadding = hPadding
82
+
self.scrollDirection = scrollDirection
80
83
}
81
84
82
85
// MARK: - COMPUTED PROPERTIES
@@ -98,7 +101,7 @@ public struct QGrid<Data, Content>: View
98
101
/// Declares the content and behavior of this view.
0 commit comments