Skip to content

Instantly share code, notes, and snippets.

@westerlund
Created May 3, 2016 09:19
Show Gist options
  • Save westerlund/950bea971e43690877d377294c8864f8 to your computer and use it in GitHub Desktop.
Save westerlund/950bea971e43690877d377294c8864f8 to your computer and use it in GitHub Desktop.
Snapping UISlider in Swift
final class SnappingSlider: UISlider {
override var value: Float {
set { super.value = newValue }
get {
return round(super.value * 1.0) / 1.0
}
}
}
@nickkaczmarek
Copy link

Wow, that worked really well. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment