Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import SwiftUI
struct ContentView: View {
var body: some View {
Canvas { context, size in
let cell: CGFloat = 40
for row in 0..<8 {
for col in 0..<8 {
let color = (row + col).isMultiple(of: 2) ? Color.orange : Color.purple
context.fill(Path(CGRect(x: CGFloat(col)*cell, y: CGFloat(row)*cell, width: cell, height: cell)), with: .color(color))
}
}
}
}
}Coding works best on desktop or with an external keyboard.