Latest 2.0.4
Homepage https://github.com/johnmcneilstudio/JMSRangeSlider
License MIT
Platforms osx 10.10
Frameworks QuartzCore
Authors

JMS Range Slider v2.0.4

A custom Range Slider for OSX

Screenshot JMSRangeSlider

JMSRangeSlider is a range slider for OSX, written in Swift 2 and built with Xcode 7.
You can define its minimum & maximum values, its lower & upper values, its direction (horizontal / vertical), the side of its cells (left / right / top / bottom of the track bar), the width & height of the cells, the tint & highlight colors of the track bar, the cells’ colors and wether or not the cells and track bar have a corner radius.

Requirements

  • OS 10.10+
  • Swift 2

Installation

CocoaPods

Add the following line to your Podfile:

target 'MyApp' do
  use_frameworks!
  pod 'JMSRangeSlider'
end

Manual

Copy the folder JMSRangeSlider to your project

CHANGELOG

EXAMPLE

let rangeSlider: JMSRangeSlider = JMSRangeSlider(frame: CGRectZero)
rangeSlider.direction = JMSRangeSliderDirection.Vertical
rangeSlider.cellsSide = JMSRangeSliderCellsSide.Left
rangeSlider.cellWidth = 20
rangeSlider.cellHeight = 30
rangeSlider.trackThickness = 10
rangeSlider.minValue = 0
rangeSlider.maxValue = 100
rangeSlider.lowerValue = 25
rangeSlider.upperValue = 75
rangeSlider.trackHighlightTintColor = NSColor(red: 0.4, green: 0.698, blue: 1.0, alpha: 1.0)
rangeSlider.frame = CGRect(x: 20.0, y: 20.0, width: self.bounds.width, height: 30.0)
rangeSlider.action = "updateRange:"
rangeSlider.target = self
self.addSubview(rangeSlider)

func updateRange(sender: AnyObject) {
    NSLog("Lower value = (rangeSlider.lowerValue)")
    NSLog("Upper value = (rangeSlider.upperValue)")
}

PROPERTIES

direction

Direction of the slider ( Horizontal / Vertical )
Type JMSRangeSliderDirection
Optional
Default: JMSRangeSliderDirection.Horizontal

cellsSide

Side of the cells ( Top / Bottom / Left / Right )
Type JMSRangeSliderCellsSide
Optional
Default:
JMSRangeSliderCellsSide.Top when direction = JMSRangeSliderDirection.Horizontal
JMSRangeSliderCellsSide.Left when direction = JMSRangeSliderDirection.Vertical

cellWidth

Width of the cells
Type CGFloat
Optional
Default: 20.0

cellHeight

Height of the cells
Type CGFloat
Optional
Default: 20.0

minValue

Minimum value
Type Double
Optional
Default: 0

maxValue

Maximum value
Type Double
Optional
Default: 1

lowerValue

Initial lower value
Type Double
Optional
Default: 0

upperValue

Initial upper value
Type Double
Optional
Default: 1

trackTintColor

Tint color of track
Type NSColor
Optional
Default: rgba(0.8, 0.8, 0.8, 1)

trackHighlightTintColor

Highlight tint color of track
Type NSColor
Optional
Default: rgba(0, 0, 0, 1)

cellTintColor

Tint color of cells
Type NSColor
Optional
Default: white

cornerRadius

Corner radius of cell
Type CGFloat
Optional
Default: 1

DEMO

There’s a demo project in the repo

LICENSE

MIT License

Latest podspec

{
    "name": "JMSRangeSlider",
    "version": "2.0.4",
    "summary": "A Custom Range Slider for OSX",
    "homepage": "https://github.com/johnmcneilstudio/JMSRangeSlider",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Matthieu Collu00e9": "[email protected]"
    },
    "source": {
        "git": "https://github.com/johnmcneilstudio/JMSRangeSlider.git",
        "tag": "v2.0.4"
    },
    "social_media_url": "https://twitter.com/jmcneilstudio",
    "screenshots": "https://github.com/johnmcneilstudio/JMSRangeSlider/raw/master/screenshot.png",
    "documentation_url": "https://github.com/johnmcneilstudio/JMSRangeSlider/blob/master/README.md",
    "platforms": {
        "osx": "10.10"
    },
    "frameworks": "QuartzCore",
    "description": "JMSRangeSlider is a custom Range Slider for OSX. Think of a NSSlider with two cells.",
    "source_files": "JMSRangeSlider/*.swift"
}

Pin It on Pinterest

Share This