I'm trying to create an equally spaced circular ruler using SwiftUI but there always appears to be one glitch when I use this code:
struct ContentView: View {
let magicNumber: CGFloat = 20
var body: some View {
VStack {
GeometryReader { geo in
Circle()
.stroke(Color.red, style: StrokeStyle(lineWidth: geo.size.width/5, lineCap: .butt, dash: [1, magicNumber]))
.padding(geo.size.width/10)
}
}.padding()
}
}
As can be seen here...
I've separated out the "magicNumber" variable in the hope there is a function/equation I could use to determine what it should be for the spacing to always be equal. Any tips? Or perhaps there is a better way to achieve this?
