Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matthewreagan/RangeSlider
Simple, clean, and customizable range-based slider control for macOS
https://github.com/matthewreagan/RangeSlider
Last synced: 2 months ago
JSON representation
Simple, clean, and customizable range-based slider control for macOS
- Host: GitHub
- URL: https://github.com/matthewreagan/RangeSlider
- Owner: matthewreagan
- Created: 2016-10-30T19:46:52.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-18T22:26:14.000Z (almost 8 years ago)
- Last Synced: 2024-08-03T01:39:31.339Z (6 months ago)
- Language: Swift
- Size: 1.4 MB
- Stars: 97
- Watchers: 5
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RangeSlider
![Styles](/RangeSliderStyles.png?raw=true "Styles")
**RangeSlider** is a clean, simple, and attractive range-based slider control for Mac, written in [Swift](https://developer.apple.com/swift/).
It is similar to [NSSlider](https://developer.apple.com/reference/appkit/nsslider) except that it affords two control points (start and end knobs), useful when users need to select a range of values.
**Features**:
- Simple, easy-to-use
- Flexible resizing
- Customizable
- Snap-to-interval (optional)
- Several built-in styles## Demo
![RangeSlider Demo](/RangeSliderDemo.gif?raw=true "RangeSlider Demo")
## How To Use
1. Add to XIB or create programmatically. Example: `let slider = RangeSlider(frame:sliderFrame)`
2. _(Optional)_ Set the min/max values (default: `0.0-1.0`)
3. _(Optional)_ Set the `start`/`end` values (default: `0.0-1.0`)
4. _(Optional)_ Enable snapping (`snapsToIntegers = true`)
5. _(Optional)_ Adjust style options (`colorStyle`, `knobStyle`)## Responding to Changes
Once the slider is configured, you can respond to changes by observing the `start`/`end` (or `length`) values, or using the `onControlChanged` property.
Example:
```
mySlider.onControlChanged = {
(slider: RangeSlider) -> Void in
print("Slider changed! Start:\(slider.start) End:\(slider.end) Range:\(slider.length)")
}
```## ToDo's
RangeSlider is still a work-in-progress. A few of the known issues / ToDo's remaining:
- [ ] Fix clipping of knob shadows, especially for circular slider style
- [ ] General cleanup, refactoring
- [ ] Fix knobs being allowed to overlap
- [ ] Improve border stroke of circular knob style
- [ ] Accessibilty support + highlighting/focus and other control behaviors## System Requirements
RangeSlider is currently macOS-only, however it could easily be updated to work with UIKit. Please file an Issue or feel free to submit a Pull Request if you'd like iOS support.
## Author
**Matt Reagan** - Website: [http://sound-of-silence.com/](http://sound-of-silence.com/) - Twitter: [@hmblebee](https://twitter.com/hmblebee)
## License
RangeSlider's source code and related resources are Copyright (C) Matthew Reagan 2016. The source code is released under the [MIT License](https://opensource.org/licenses/MIT). If you use RangeSlider in any publicly-distributed applications please include attribution.