Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import SwiftUI
struct ContentView: View {
func hexagon(at center: CGPoint, radius: CGFloat) -> Path {
var path = Path()
for i in 0..<6 {
let angle = Double(i) * .pi / 3
let point = CGPoint(x: center.x + cos(angle) * radius, y: center.y + sin(angle) * radius)
i == 0 ? path.move(to: point) : path.addLine(to: point)
}
path.closeSubpath()
return path
}
var body: some View {
Canvas { context, size in
for x in stride(from: 30.0, to: size.width, by: 60) {
for y in stride(from: 30.0, to: size.height, by: 52) {
context.stroke(hexagon(at: CGPoint(x: x, y: y), radius: 25), with: .color(.green))
}
}
}
}
}Coding works best on desktop or with an external keyboard.
~`
!1
@2
#3
$4
%5
^6
&7
*8
(9
)0
_-
+=
⌫
Tab
Q
W
E
R
T
Y
U
I
O
P
{[
}]
|\
Caps
A
S
D
F
G
H
J
K
L
:;
"'
↵
⇧
Z
X
C
V
B
N
M
<,
>.
?/
⇧
Ctrl
⊞
Alt
␣
Alt
⊞
Ctx
Ctrl
left
👉Middle
i
right
L Pinky
L Ring
L Middle
L Index
Thumb
R Index
R Middle
R Ring
R Pinky