Skip to content

Instantly share code, notes, and snippets.

@HamGuy
Forked from cumanzor/steppedSlider.swift
Created May 23, 2018 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HamGuy/bab0a5d1e63bac7bbc6361dc48059e1b to your computer and use it in GitHub Desktop.
Save HamGuy/bab0a5d1e63bac7bbc6361dc48059e1b to your computer and use it in GitHub Desktop.
stepped UISlider.
let step: Float = 50;
// extra slider initialization. the IBAction func below points to the UISlider we are using.
@IBAction func onStrengthChange(sender: UISlider) {
let roundedValue = round(sender.value/step) * step
sender.value = roundedValue
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment