Latest 1.8.2
Homepage https://github.com/yonat/MultiSlider
License MIT
Platforms ios 9.0, requires ARC
Dependencies MiniLayout, AvailableHapticFeedback
Authors

UISlider clone with multiple thumbs and values, optional snap intervals, optional value labels.

Swift Version
Build Status
License
CocoaPods Compatible
Platform
PRs Welcome

MultiSliderMultiSlider

Usage

let slider   = MultiSlider()
slider.minimumValue = 1    // default is 0.0
slider.maximumValue = 5    // default is 1.0
slider.snapStepSize = 0.5  // default is 0.0, i.e. don't snap

slider.value = [1, 4.5, 5]

slider.addTarget(self, action: #selector(sliderChanged(_:)), forControlEvents: .valueChanged) // continuous changes
slider.addTarget(self, action: #selector(sliderDragEnded(_:)), forControlEvents: . touchUpInside) // sent when drag ends

Getting Multiple Thumb Values

func sliderChanged(slider: MultiSlider) {
    print("(slider.value)") // e.g., [1.0, 4.5, 5.0]
}

Changing Appearance

slider.orientation = .horizontal
slider.thumbImage   = UIImage(named: "balloon")
slider.minimumImage = UIImage(named: "clown")
slider.maximumImage = UIImage(named: "cloud")
slider.tintColor = .cyan
slider.trackWidth = 5
slider.hasRoundTrackEnds = true
slider.showsThumbImageShadow = false

Adding Labels Showing Thumb Value

slider.valueLabelPosition = .left // .notAnAttribute = don't show labels
slider.isValueLabelRelative = true // shows differences instead of absolute values

Disabling/Freezing Thumbs

slider.disabledThumbIndices = [1, 3]

Requirements

  • iOS 9.0+
  • Xcode 9

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'

Manually:

Copy Sources/*.swift and MiniLayout.swift to your Xcode project.

TODO

  • [ ] Fix IB presentation. (dlopen error "image not found", thumbs should be vertically centered and evenly distributed.)

Meta

@yonatsharon

https://github.com/yonat/MultiSlider

Latest podspec

{
    "name": "MultiSlider",
    "version": "1.8.2",
    "summary": "UISlider clone with multiple thumbs and values, optional snap intervals, optional value labels.",
    "homepage": "https://github.com/yonat/MultiSlider",
    "screenshots": [
        "https://raw.githubusercontent.com/yonat/MultiSlider/master/Screenshots/MultiSlider.png",
        "https://raw.githubusercontent.com/yonat/MultiSlider/master/Screenshots/MultiSlider-h.png"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE.txt"
    },
    "authors": {
        "Yonat Sharon": "[email protected]"
    },
    "social_media_url": "http://twitter.com/yonatsharon",
    "swift_version": "4.2",
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/yonat/MultiSlider.git",
        "tag": "1.8.2"
    },
    "source_files": "Sources/*.swift",
    "dependencies": {
        "MiniLayout": [],
        "AvailableHapticFeedback": []
    }
}

Pin It on Pinterest

Share This