Customizable two way slider split in the middle. Left and right parts are independent, each can have different min, max, step, colors, etc.
Simply add as custom view to storyboard or create programatically.
let slider = SplitSlider()
// Minimal slider value.
slider.min = 0
// Maximal slider value.
slider.max = 100
// Step value of the slider.
slider.step = 5
// Font of the value labels.
slider.labelFont = UIFont.systemFont(ofSize: 10)
// Font color of the value labels.
slider.labelTextColor = UIColor.black
// Size of the slider's thumb.
slider.thumbSize = 20
// Color of the thumb.
slider.thumbColor = UIColor.darkGray
// Track height.
slider.trackHeight = 0
// Track color.
slider.trackColor = = UIColor.lightGray
// Color of selected part of the track.
slider.trackHighlightColor = UIColor.gray
// Determines if thumb should be snapped to the closest step after the move.
slider.snapToStep = true
All above properties would affect both portions of the slider but can be set individually through either slider.left
or slider.right
portion.
// Called when user selects (holds) portion of the slider. Return `nil` when no portion is being hold.
slider(_ slider: SplitSlider, didSelect portion: SplitSliderPortion?)
// Called when user drags the thumb and portion value is thus updated.
slider(_ slider: SplitSlider, didUpdate value: CGFloat, for portion: SplitSliderPortion)
To run the example project, run pod try
.
iOS 8+.
SplitSlider is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SplitSlider"
Tomas Friml, instantni.med@gmail.com
SplitSlider is available under the MIT license. See the LICENSE file for more info.