ColorPickTip
Overview
- Simple color-picker for iOS.
- Picked color is detected in closure.
- Customizable palette using UIColor.
Demo
Requirements
- Xcode10
- Swift 4.2
- iOS 9.3 or higher
Installation
ColorPickTip is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ColorPickTip'
Usage
ColorPickTip is based on UIPopoverPresentationController.
To show it, use present(_:animated:completion:)
method.
let paletteColors: [[UIColor?]] = [[.red, .green, .blue], [.white, nil, .black]]
let colorPickTipVC = ColorPickTipController(palette: paletteColors, options: nil)
colorPickTipVC.popoverPresentationController?.delegate = colorPickTipVC
colorPickTipVC.popoverPresentationController?.sourceView = sender // some UIButton
colorPickTipVC.popoverPresentationController?.sourceRect = sender.bounds
self.present(colorPickTipVC, animated: true, completion: nil)
Options
There are some options.
/// Theme color of PopupView. Default is light.
public var popoverViewTheme: PopoverViewTheme
/// Style for color palette. Default is round.
public var paletteStyle: PaletteStyle
/// Dismiss popover after picked. Default is true.
public var isDismissOnPick: Bool
/// ViewSize. Default is width:240 / height:150.
public var viewSize: CGSize
Author
Yuki Yamashita@akeome Twitter
License
ColorPickTip is available under the MIT license. See the LICENSE file for more info.