/SwiftlySlider

A simple iOS slider control

Primary LanguageSwiftMIT LicenseMIT

SwiftlySlider

Version License Platform CocoaPods CocoaPods

A simple iOS slider control.

alt tag

Installation

CocoaPods:

pod 'SwiftlySlider'

Manual:

Just copy the SwiftlySlider.swift into your project.

Using

You can create from Storyboard or XIB. Or create manually:

let slider = SwiftlySlider()

For handling changing of values you should implement a protocol SwiftlySliderDelegate:

slider.delegate = self

func swiftlySliderValueChanged(value: Int) {
}

Direction:

picker.direction = SwiftlySlider.PickerDirection.Horizontal // Vertical, Horizontal

Also you can change the current value, the maximum value or the minimum value, for example:

picker.currentValue = 0
picker.maxValue     = 30
picker.minValue     = 1

Slider settings:

sliderImage       // Custom an image of the slider
sliderImageOffset // A offset of the custom slider position
sliderSize        // A size of the custom slider position

Example:

slider.sliderImage = UIImage(named: "CustomSlider")
slider.sliderImageOffset = CGPoint(x: 0, y: -1)
slider.sliderSize = CGSize(width: 30, height: 15)

Normal indicator:

useNormalIndicator  // Use a normal indicator
normalValue         // A normal value

Color settings:

labelFontColor        // A font color of the moving label
labelBackgroundColor  // A background color of the moving label
labelFont             // A font of the moving label
bgColor               // A background color

You can easily found the example in this repository.

License

SwiftlySlider is available under the MIT license. See the LICENSE file for more info.