Skip to content
This repository was archived by the owner on Dec 27, 2020. It is now read-only.

Commit df32971

Browse files
committed
readme
1 parent 865e259 commit df32971

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

Examples/GridExamples/PerformanceLayoutView.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import Grid
33

44
struct PerformanceLayoutView: View {
55
var body: some View {
6-
Grid(0...5000) { number in
7-
Rectangle()
8-
.foregroundColor(.random)
6+
Grid {
7+
ForEach(0...5000, id: \.self) { _ in
8+
Rectangle()
9+
.foregroundColor(.random)
10+
}
911
}
1012
.gridStyle(
1113
AutoColumnsGridStyle(minItemWidth: 16, itemHeight: 16, spacing: 0)

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## SwiftUI Grid
22

3-
SwiftUI Grid view layout with auto-sizing items and flexible column count.
3+
SwiftUI Grid view layout with custom styles.
44

55
<center>
66
<img src="Resources/iPad1.png"/>
@@ -20,19 +20,21 @@ Grid(0...100) { _ in
2020
}
2121
```
2222

23-
```
24-
Grid(0...100) { _ in
25-
Rectangle()
26-
.foregroundColor(.red)
23+
```swift
24+
Grid {
25+
ForEach(items, id: \.self) { item in
26+
Rectangle()
27+
.foregroundColor(item.color)
28+
}
2729
}
30+
.padding(.horizontal, 8)
2831
.gridStyle(
2932
AutoColumnsGridStyle(minItemWidth: 160, itemHeight: 80, hSpacing: 8, vSpacing: 8)
3033
)
3134
```
3235
### FixedColumnsGridStyle
3336

3437
```swift
35-
3638
Grid(0...100) { number in
3739
Card(title: "\(number)")
3840
}
@@ -57,14 +59,13 @@ Grid(0...100) { number in
5759
<img src="Resources/iPad2.png"/>
5860
</center>
5961

60-
## Requirements
61-
62-
- Swift 5+
62+
## SDKs
6363
- iOS 13+
64+
- Mac Catalyst 13.0+
6465
- macOS 10.15+
66+
- Xcode 11.0+
6567

6668
## Roadmap
67-
- ZStack based grid instead of 'VStack of HStacks'
6869
- Support for watchOS
6970
- Items selection and rearranging
7071
- UITests

0 commit comments

Comments
 (0)