-
Notifications
You must be signed in to change notification settings - Fork 0
/
GridBootcamp.swift
80 lines (70 loc) · 2.67 KB
/
GridBootcamp.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// GridBootcamp.swift
// SwiftfulThinkingBootcamp
//
// Created by enesozmus on 9.05.2024.
//
import SwiftUI
struct GridBootcamp: View {
let columns: [GridItem] = [
// GridItem(.fixed(50), spacing: nil, alignment: nil),
// GridItem(.fixed(50), spacing: nil, alignment: nil),
// GridItem(.fixed(75), spacing: nil, alignment: nil),
// GridItem(.fixed(50), spacing: nil, alignment: nil),
// GridItem(.fixed(50), spacing: nil, alignment: nil)
// GridItem(.flexible())
// GridItem(.adaptive(minimum: 50, maximum: 300), spacing: nil, alignment: nil),
// GridItem(.adaptive(minimum: 150, maximum: 300), spacing: nil, alignment: nil)
GridItem(.flexible(), spacing: nil, alignment: nil),
GridItem(.flexible(), spacing: nil, alignment: nil),
GridItem(.flexible(), spacing: nil, alignment: nil)
]
var body: some View {
// LazyVGrid(columns: columns) {
// ForEach(0..<50) { index in
// Rectangle()
// .frame(height: 50)
// }
// }
ScrollView {
Rectangle()
.fill(.orange)
. frame(height: 400)
LazyVGrid(
columns: columns,
alignment: .center,
pinnedViews: [],
content: {
Section(header:
Text("Section 1")
.foregroundColor(.white)
.font(.title)
.frame(maxWidth: .infinity, alignment: .leading)
.background(.blue)
.padding()
) {
ForEach(0..<20) { index in
Rectangle()
.frame(height: 150)
}
}
Section(header:
Text("Section 2")
.foregroundColor(.white)
.font(.title)
.frame(maxWidth: .infinity, alignment: .leading)
.background(.blue)
.padding()
) {
ForEach(0..<20) { index in
Rectangle()
.frame(height: 150)
}
}
})
}
}
}
#Preview {
GridBootcamp()
}