- Ready to use
- Easy customization (font, colors, images, ticks...)
- @IBInspectable
- Tappable
- Draggable
- Titles support
- Rotation support
- Swift 4 ready
- Add CocoaPods support
- Swift 4 support: use branch master
- Master supports sliderStep.value programmatically
- Swift 3 support: use branch master
- Swift 2.3 support: use branch swift_2.3
- Swift 2 branch moved: use old branch swift_2.x
- .ValueChanged event invoked on slider tap.
- Import G8SliderStep.swift into you project
- Add UISlider in you Storyboard file
- Set the UISlider class to G8SliderStep
- Configure your slider by storyboard or/and by code
- Enjoy :)
####Customizable properties
@IBInspectable var enableTap: Bool = true
@IBInspectable var trackHeight: Float = 4
@IBInspectable var trackColor: UIColor = UIColor.lightGrayColor()
@IBInspectable var drawTicks: Bool = true
@IBInspectable var stepTickWidth: Float = 15
@IBInspectable var stepTickHeight: Float = 15
@IBInspectable var stepTickColor: UIColor = UIColor.lightGrayColor()
@IBInspectable var stepTickRounded: Bool = true
@IBInspectable var unselectedFont: UIFont = UIFont.systemFontOfSize(13)
@IBInspectable var selectedFont: UIFont = UIFont.systemFontOfSize(13)
@IBInspectable var stepTitlesOffset: CGFloat = 1
var customTrack: Bool = true
///Requireds
var stepImages: [UIImage]?
//Optionals
var tickTitles: [String]?
var tickImages: [UIImage]?
TODO
- iOS 8.0+
- Xcode 7.3.1+
@IBOutlet weak var sliderStep: G8SliderStep!
override func viewDidLoad() {
super.viewDidLoad()
///G8SliderStep configuration
sliderStep.stepImages = [UIImage(named:"star")!, UIImage(named:"heart")!, UIImage(named:"house")!]
sliderStep.tickTitles = ["STAR", "HEART", "HOUSE"]
let shape = UIImage(named:"shape")!
sliderStep.tickImages = [shape, shape, shape]
sliderStep.minimumValue = 2
sliderStep.maximumValue = Float(sliderStep.stepImages!.count) + sliderStep.minimumValue - 1.0
sliderStep.trackColor = UIColor.darkGray
sliderStep.stepTickColor = UIColor.orange
sliderStep.stepTickWidth = 30
sliderStep.stepTickHeight = 30
sliderStep.trackHeight = 10
sliderStep.value = 3
}
G8SliderStep is distributed under the MIT license (see LICENSE.md).
Daniele Galiotto (founder) - iOS Freelance Developer - www.g8production.com