YSColorPicker

YSColorPicker is an easy-to-use swift color picker library for iOS.

Features

-RGB
-RGBA
-HSB
-HSBA
-ColorPicker
-ColorPicker (alpha)
You can select any number from these modes.

Installation

CocoaPods

  1. Add pod 'YSColorPicker',: git => 'https: // github.com / sekies / YSColorPicker.git' to Podfile.
  2. Do a pod install.

Usage

  1. Import YSColorPicker.
     Swift  import YSColorPicker
  2. Comply with the YSColorsTabViewControllerDelegate protocol on any UIViewContoroller.
     Swift  class ViewController: UIViewController, YSColorsTabViewControllerDelegate {
  3. Create a YSColorsTabViewController instance when you want to use the color picker. Specify the initial color and picker type at generation time.
      Swift   let tabvc = YSColorsTabViewController (color: .blue, colorTypes: [       .YS_COLOR_RGB,       .YS_COLOR_RGBA,       .YS_COLOR_HSB,       .YS_COLOR_HSBA   ])
  4. The color picker is displayed as TabViewController. Set background color of view and delegate and open it modally.
      * Please note that the delegate setting is ysColorDelegate.
      Swift   tabvc.view.backgroundColor = .white   tabvc.ysColorDelegate = self   present (tabvc, animated: true, completion: nil)
      The type can be specified from the following 6 types.
      .YS_COLOR_PICKER,   .YS_COLOR_PICKERA,   .YS_COLOR_RGB,   .YS_COLOR_RGBA,   .YS_COLOR_HSB,   .YS_COLOR_HSBA
  5. Implement the delegate method. This method is called whenever the color changes on the picker.
      Swift   func ysChanged (color: UIColor) {         print (color)   }

GitHub