SSCircularSlider
A simple and powerful circular ring slider, written in swift and fully customizable.
Features!
- Circular ring slider
- Customizable slider color
- Customizable slider knob
- Customizable sider end point buttons
- Adjust slider by editing center label
- Dynammic values of slider
- CocoaPods
Requirements
- iOS 10.0+
- Xcode 9+
Installation
CocoaPods
-
You can use CocoaPods to install SSSpinnerButton by adding it to your Podfile:
use_frameworks! pod 'SSCircularSlider'
-
import UIKit import SSCircularSlider
Manually
- Download and drop SSCircularSlider folder in your project.
- Congratulations you are done with installation!
Usage example
-
In the storyboard add a UIView and change its class to SSCircularSlider
SetValues
let arrValues: [Int] = [Int](0...30) circularRingSlider.setArrayValues(labelValues: arrValues, currentIndex: indexOfValue)
SetInitialValue
let arrValues: [Int] = [Int](0...30) indexOfValue = 0 circularRingSlider.setValues(initialValue: arrValues[indexOfValue].toCGFloat(), minValue: arrValues[0].toCGFloat(), maxValue: arrValues[arrValues.count-1].toCGFloat())
SetKnobImage
circularRingSlider.setKnobOfSlider(knobSize: 40, knonbImage: UIImage(named: "iconKnobRed")!)
SetTextFieldDelegate
circularRingSlider.setValueTextFieldDelegate(viewController: self)
SetRingWidth
circularRingSlider.setCircularRingWidth(innerRingWidth: 18, outerRingWidth: 18)
SetBackgroundColorOfAllButtons
circularRingSlider.setBackgroundColorOfAllButtons(startPointColor: UIColor.red, endPointColor: UIColor.lightGray, knobColor: UIColor.white)
SetEndPointImages
circularRingSlider.setEndPointsImage(startPointImage: iconMinus, endPointImage: iconPlus)
SetProgressLayerColor(Gradient Colors)
circularRingSlider.setProgressLayerColor(colors: [UIColor.red.cgColor, UIColor.red.cgColor])
SetCircularSliderDelegate
extension ViewController: SSCircularRingSliderDelegate { func controlValueUpdated(value: Int) { print("current control value:\(value)") // Your code here } }
Contribute
- We would love you for the contribution to SSCircularSlider, check the LICENSE file for more info.
Meta
- Distributed under the MIT license. See LICENSE for more information.