This is a swift implementation of custom UIControl that allows users to select a range of values on a slider bar with 2 knobs.
- iOS 8.0+
- Xcode 8+
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapodsCocoaPods 0.39.0+ is required to build SwiftRangeSlider.
To integrate SwiftRangeSlider into your Xcode project using CocoaPods, specify it in your Podfile:
platform :ios, ‘8.0’
use_frameworks!
target '[your_app_name]' do
pod ‘SwiftRangeSlider’
endThen, run the following command:
$ pod installimport SwiftRangeSliderTo use SwiftRangeSlider on a storyboard, add a UIView to your view controller and set its class to RangeSlider.
Most of the customization parameters can be changed through IBDesignable and IBInspectable and should be reflected on the storyboard!
To reference the RangeSlider on your storyboard in your view controller's file, create an @IBOutlet connection of type RangeSlider:
@IBOutlet weak var rangeSlider: RangeSlider!In order to initially reflect your layout settings via autolayout when the view controller loads, please call the updateLayerFrames() function inside of viewDidLayoutSubviews():
override func viewDidLayoutSubviews() {
rangeSlider.updateLayerFrames()
}let rangeSlider:RangeSlider = RangeSlider()

