Slider Component
The slider component is a reusable slider that allows you to create customizable slider by setting with minimum value, maximum value, active slider line color
Features
- Create slider.
- Customize minimum value, maximum value, active slider line color
- Interact with slider knob and get selected value through closure onValueChange.
Installation
-
Copy the
slider
component folder into your Xcode project. -
Use the
OCSlider
view in your SwiftUI code:
import SwiftUI
struct ContentView: View {
var body: some View {
VStack{
OCSlider(sliderValue: 0.5, minValue: 0.0, maxValue: 1.0, onValueChange: { newValue in
print("Selected value: \(newValue)")
}, sliderConfiguration: OCSliderConfiguration(activeColor: Color.sliderIosSliderLine))
}
.padding()
}
}