FlorianCP / SwiftColorPicker

An iOS HSB color picker implemented in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwiftColorPicker

Swift Color Picker Screenshot

##Installation ###CocoaPod Podfile:

use_frameworks!
pod 'SwiftColorPicker'

##Usage ###Simple Example Create a Storyboard with 3 views and set the Classes to ColorWell (UIButton), ColorPicker (UIView) and HuePicker (UIView). Wire the Outlets with the following code:

import SwiftColorPicker

...

@IBOutlet var colorWell:ColorWell?
@IBOutlet var colorPicker:ColorPicker?
@IBOutlet var huePicker:HuePicker?

...
// Setup
pickerController = ColorPickerController(svPickerView: colorPicker!, huePickerView: huePicker!, colorWell: colorWell!)
pickerController?.color = UIColor.redColor()

// get color:
pickerController!.color

// get color updates:
pickerController?.onColorChange = {(color, finished) in
    if finished {
      self.view.backgroundColor = UIColor.whiteColor() // reset background color to white
    } else {
        self.view.backgroundColor = color // set background color to current selected color (finger is still down)
    }
}

##Show case https://itunes.apple.com/us/app/binary-clock-widget/id965640631

##License MIT-License

About

An iOS HSB color picker implemented in Swift

License:MIT License


Languages

Language:Swift 97.0%Language:Ruby 3.0%