-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.swift
More file actions
36 lines (27 loc) · 845 Bytes
/
.swift
File metadata and controls
36 lines (27 loc) · 845 Bytes
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
import SwiftUI
@main
struct Grid: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
@State var arrColors : [Color] = [.yellow, .orange, .red, .cyan, .blue, .green, .brown, .gray, .black, .purple]
let columns = [GridItem(.flexible()), GridItem(.flexible())]
var body: some View {
VStack {
Text("Grid made using Swift For codebox!!")
.font(.title)
LazyVGrid(columns: columns) {
ForEach(0..<arrColors.count) { i in
RoundedRectangle(cornerRadius: 13)
.fill(arrColors[i])
.frame(height: 110)
}
}
}
.padding()
}
}