GithubHelp home page GithubHelp logo

marcllahona / rangeslider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matthewreagan/rangeslider

0.0 2.0 0.0 1.44 MB

Simple, clean, and customizable range-based slider control for macOS

Swift 100.00%

rangeslider's Introduction

RangeSlider

Styles

RangeSlider is a clean, simple, and attractive range-based slider control for Mac, written in Swift.

It is similar to 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

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/ - Twitter: @hmblebee

License

RangeSlider's source code and related resources are Copyright (C) Matthew Reagan 2016. The source code is released under the MIT License. If you use RangeSlider in any publicly-distributed applications please include attribution.

rangeslider's People

Contributors

matthewreagan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.