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 center = CGPoint(x: size.width/2, y: size.height/2)
for i in 0..<24 {
let angle = Double(i) * .pi / 12
let x = center.x + cos(angle) * 80
let y = center.y + sin(angle) * 80
context.fill(Path(ellipseIn: CGRect(x: x-15, y: y-15, width: 30, height: 30)), with: .color(.purple))
}
}
}
}Coding works best on desktop or with an external keyboard.