Skip to content

Custom Range UISlider for iOS, in Swift - Draggable, Tappable, Inspectable.

License

Notifications You must be signed in to change notification settings

gali8/G8SliderStep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

G8SliderStep

A custom range UISlider for iOS, written in Swift - Draggable, Tappable, @IBInspectable

How it works

Samples

Features:

  • Ready to use
  • Easy customization (font, colors, images, ticks...)
  • @IBInspectable
  • Tappable
  • Draggable
  • Titles support
  • Rotation support
  • Swift 4 ready

ToDo:

  • Add CocoaPods support

Release note:

v3.0.0
  • Swift 4 support: use branch master
v2.0.1
  • Master supports sliderStep.value programmatically
v2.0
  • Swift 3 support: use branch master
v1.4
  • Swift 2.3 support: use branch swift_2.3
  • Swift 2 branch moved: use old branch swift_2.x
v1.1
  • .ValueChanged event invoked on slider tap.

How to use:

Manual

  • 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]?

CocoaPods

TODO

Requirements

  • iOS 8.0+
  • Xcode 7.3.1+

Example Usage

By Code

@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
    }

By Storyboard

Buy me a beer

If you like my work, please buy me a beer (tap the beer):

License

G8SliderStep is distributed under the MIT license (see LICENSE.md).

Contributors

Daniele Galiotto (founder) - iOS Freelance Developer - www.g8production.com

About

Custom Range UISlider for iOS, in Swift - Draggable, Tappable, Inspectable.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages