HASlider provide slider with two handler and custom tip view over them. Developer has to pass his custom view in tip view. HASlider has delegates methods for track change in value and update tipview according to new value.
Swift 4, Xcode 9.0+
HASlider is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'HASlider', :git => 'https://github.com/Hitesh136/HASlider'
To run the example project, clone the repo, and run pod install
from the Example directory first.
Add UIView in interface builder and open its identityinspector and set its custom class as HASlider or HAVerticalSlider.
HASlider --- Horizontal Slider
HAVerticalSlider --- Vertical Slider
Set it's property in interface builder or programmatically.
minimum possible value slider could have.
Maximum possible value slider could have.
value of left cirlcle.
value of right circle
Color of slider line
Background color of left circle. If lefthandlerimage
is set than left circle's background color is clear.
Image shown on lefthandler. handler's size change equal to image size.
Background color of right circle. If righthandlerimage
is set than right circle's background color is clear.
Image shown on righthandler. Handler's size change equal to image size.
Color between slider's starting point and left handler. If leftselectioncolor is clear than linebackgroundcolor is visiable.
Color between left handler and right handler. If middleSelectionColor is clear than linebackgroundcolor is visiable.
Color between right handler and sliderline's end point. If rightSelectionColor is clear than linebackgroundcolor is visiable.
Custom view over left circle. assign your custom view in leftTipView programmatically
slider1.leftTipView = leftView
If any view is not assign in leftTipView than nothing will show above left circle.
Custom view over right circle. assign your custom view in rightTipView programmatically
slider1.rightTipView = rightView
If any view is not assign in rightTipView than nothing will show above right circle.
if true
than slider have only one circle and left value work as main value.
default value is false.
set roundCorner of slider line.
Implement delegate methods for listen change in value and update cutom tip view for new value.
// isTrackingLeftHandler = if tracking left handler
// isTrackingRightHandler = if tracking right handler
extension ViewController: SliderDelegate {
func beginTracking(slider: HASlider, isTrackingLeftHandler: Bool, isTrackingRightHandler: Bool) {
// Begin tracking of handler
}
func continueTracking(slider: HASlider, isTrackingLeftHandler: Bool, isTrackingRightHandler: Bool) {
// Continuously moving handler
}
func endTracking(slider: HASlider, isTrackingLeftHandler: Bool, isTrackingRightHandler: Bool) {
// Stop moving handler
}
}
Hitesh Agarwal, agarwal.hitesh94@gmail.com
HASlider is available under the MIT license. See the LICENSE file for more info.