slider.snapStepSize = 0.5 // default is 0.0, i.e. don't snap
slider.snapValues = [1, 2, 4, 8] // specify specific snap values instead uniform steps
slider.isHapticSnap = false // default is true, i.e. generate haptic feedback when sliding over snap values
slider.snapImage = UIImage(systemName: "circle.fill") // default: no image
Changing Appearance
slider.tintColor = .cyan // color of track
slider.thumbTintColor = .blue // color of thumbs
slider.trackWidth = 32
slider.hasRoundTrackEnds = true
slider.showsThumbImageShadow = false // wide tracks look better without thumb shadow
slider.centerThumbOnTrackEnd = true // when thumb value is minimum or maximum, align it's center with the track end instead of its edge
Images
// add images at the ends of the slider:
slider.minimumImage = UIImage(named: "clown")
slider.maximumImage = UIImage(named: "cloud")
// change image for all thumbs:
slider.thumbImage = UIImage(named: "balloon")
// or let each thumb have a different image:
slider.thumbViews[0].image = UIImage(named: "ball")
slider.thumbViews[1].image = UIImage(named: "club")
Distance/Overlap Between Thumbs
// allow thumbs to overlap:
slider.keepsDistanceBetweenThumbs = false
// make thumbs keep a greater distance from each other (default = half the thumb size):
slider.distanceBetweenThumbs = 3.14
Disabling/freezing thumbs
slider.disabledThumbIndices = [1, 3]
Requirements
iOS 9.0+
Xcode 10
Installation
CocoaPods:
pod 'MultiSlider'
Legacy versions:
Swift version
MultiSlider version
4.0 (Xcode 9.4)
pod 'MiniLayout', '~> 1.2.1' pod 'MultiSlider', '~> 1.6.0'
3
pod 'MiniLayout', '~> 1.1.0' pod 'MultiSlider', '~> 1.1.2'
2.3
pod 'MiniLayout', '~> 1.0.1' pod 'MultiSlider', '~> 1.0.1'
MultiSlider
UISlider clone with multiple thumbs and values, range highlight, optional snap values, optional value labels, either vertical or horizontal.
Features
Usage
SwiftUI Usage
The properties mentioned below can be used as modifiers, or passed as arguments to the
MultiValueSlider
initializer. For example:Getting multiple thumb values
Use
value
to get all thumbs values, anddraggedThumbIndex
to find which thumb was last moved.Range slider
Vertical / horizontal orientation
Value labels
For more control over the label text:
Snap steps
Changing Appearance
Images
Distance/Overlap Between Thumbs
Disabling/freezing thumbs
Requirements
Installation
CocoaPods:
Legacy versions:
pod 'MiniLayout', '~> 1.2.1'
pod 'MultiSlider', '~> 1.6.0'
pod 'MiniLayout', '~> 1.1.0'
pod 'MultiSlider', '~> 1.1.2'
pod 'MiniLayout', '~> 1.0.1'
pod 'MultiSlider', '~> 1.0.1'
Swift Package Manager:
Meta
@yonatsharon
https://github.com/yonat/MultiSlider