buh/Spiral
Spiral is a SwiftUI shape for macOS, iOS and watchOS.
Spiral Shape
It has several parameters:
pathType: the type of path you want to draw.startAt: the start angle of a spiral.endAt: the end angle of a spiral.smoothness: the point density which describes a spiral.offsetRadius: spiral radius offset for each point with respect to the calculated angle and frame.offsetAngle: angle offset of each spiral point with respect to the calculated angle and frame.
<img width="746" alt="image" src="https://user-images.githubusercontent.com/284922/168490287-a263e152-8654-4e0d-85cb-d7a119f64838.png">
var body: some View {
Spiral(
startAt: .degrees(90),
endAt: .degrees(360)
)
.stroke(
Color.blue,
style: .init(lineWidth: 20, lineCap: .round, lineJoin: .round)
)
}Spiral View
When usingSpiralView, you need to position the content based on the spiral point coordinates.
var body: some View {
SpiralView(
startAt: .degrees(90),
endAt: .degrees(360)
) { index, spiralPoint in
Text("Hello")
.position(x: spiralPoint.point.x, y: spiralPoint.point.y)
}
}Documentation
You can find the generated DocC documentation here.
Demo App
You can play with all the parameters in the demo app, which can be run on macOS, iPad, iPhone.
The app heavily uses the CompactSlider, which you can find out more about here.
Support
You can buy me a coffee here ☕️
License
Spiral is available under the MIT license
Package Metadata
Repository: buh/Spiral
Stars: 82
Forks: 3
Open issues: 0
Default branch: main
Primary language: swift
License: MIT
Topics: ios, ipados, macos, shape, swift, swiftui, ui-components, watchos
README: README.md