Created
May 3, 2016 09:19
-
-
Save westerlund/950bea971e43690877d377294c8864f8 to your computer and use it in GitHub Desktop.
Snapping UISlider in Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class SnappingSlider: UISlider { | |
override var value: Float { | |
set { super.value = newValue } | |
get { | |
return round(super.value * 1.0) / 1.0 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow, that worked really well. Thanks!