Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import SwiftUI
struct ContentView: View {
var body: some View {
Canvas { context, size in
for x in stride(from: 0.0, to: size.width, by: 40) {
for y in stride(from: 0.0, to: size.height, by: 40) {
var path = Path()
path.move(to: CGPoint(x: x, y: y))
path.addLine(to: CGPoint(x: x+40, y: y))
path.addLine(to: CGPoint(x: x+20, y: y+40))
path.closeSubpath()
context.fill(path, with: .color(.cyan))
}
}
}
}
}Coding works best on desktop or with an external keyboard.