A SwiftUI slider component that follows any custom Path, enabling unique and engaging user interactions.
This example uses the Path(ellipseIn: CGRect)
initializer to quickly create a path. The View
holds the @State
for both the Slider's value
and also the pathPoint
, which is the location of the
"thumb" indicator.
This example uses a SwiftUI Shape
and the included slider
extension method to leverage the Path provided by the Shape.
Here we render two PathSlider
components by using a Circle and a RoundedRectangle. Note that the RoundedRectangle shape is
is modified using the trim
method to have the open ended top.
Included in the Examples
directory is the Examples.xcodeproj
. Take a look at this project to get a more interactive look at
the usage examples above. If you have any interesting examples you'd like to share, pull requests are welcome!