A simple range slider made in Swift.
This control is IBDesignable and uses the target-action pattern for change notifications.
In order to be notified when either thumb value changes, register for .ValueChanged:
let rangeSlider = RangeSlider(frame: frame)
view.addSubView(rangeSlider)
rangeSlider.addTarget(self, action: #selector(viewController.rangeSliderValueChanged(_:)),
for: .valueChanged)
The range slider can be customized and information can be accessed through these properties :
minimumValue
: The minimum possible value of the rangemaximumValue
: The maximum possible value of the rangelowerValue
: The value corresponding to the left thumb current positionupperValue
: The value corresponding to the right thumb current positiontrackTintColor
: The track colortrackHighlightTintColor
: The color of the section of the track located between the two thumbsthumbTintColor
: The thumb colorthumbBorderColor
: The thumb border colorthumbBorderWidth
: The width of the thumb bordercurvaceousness
: From 0.0 for square thumbs to 1.0 for circle thumbs
RangeSlider is available through CocoaPods. To install it, simply add the following line to your Podfile :
pod "WARangeSlider"
RangeSlider is available under the MIT License
If you use it and like it, let me know: @warchimede