A SwiftUI component that provides an infinite circular slider for precise value adjustments, inspired by the rotation dial commonly found in professional editing applications.
- 🔄 Infinite scrolling - Smoothly scroll in either direction without limits
- 🎯 Precise control - Fine-grained value adjustments with customizable stride
- 📳 Haptic feedback - Built-in sensory feedback on value changes
- 🎨 Native SwiftUI - Seamlessly integrates with your SwiftUI views
- ⚡ Fast deceleration - Natural feeling momentum scrolling
- iOS 17.0+
- Swift 5.9+
- Xcode 15.0+
Add the following to your Package.swift file:
dependencies: [
.package(url: "https://github.com/FluidGroup/swiftui-ring-slider", from: "1.0.0")
]Or add it directly in Xcode:
- Go to File > Add Package Dependencies...
- Enter the repository URL:
https://github.com/FluidGroup/swiftui-ring-slider - Select your desired version rules
- Click Add Package
import SwiftUIRingSlider
struct ContentView: View {
@State private var value: Double = 0
var body: some View {
VStack {
Text("Value: \(String(format: "%.2f", value))")
RingSlider(value: $value)
}
}
}Control the increment/decrement step size using the stride parameter:
RingSlider(value: $value, stride: 0.5)Limit the slider to a specific range using valueRange:
RingSlider(
value: $value,
stride: 1,
valueRange: 0...100
)public init(
value: Binding<Double>,
stride: Double = 1,
valueRange: ClosedRange<Double> = (-Double.greatestFiniteMagnitude...Double.greatestFiniteMagnitude)
)| Parameter | Type | Default | Description |
|---|---|---|---|
value |
Binding<Double> |
Required | A binding to the current value of the slider |
stride |
Double |
1 |
The amount to increment/decrement the value per scroll unit |
valueRange |
ClosedRange<Double> |
Full Double range |
The range of allowable values for the slider |
This package uses SwiftUIIntrospect to enable infinite scrolling functionality.
MIT License. See LICENSE for details.
