a simple PopupDialog for picking a color from a list of colors
The standard theme
An example of custom theme utilizing tint color, font, and a custom list of colors
add the folowing to your Carfile:
github "kautenja/UIPopupColorPicker" ~> 1.1
To run the example project, clone the repo, and it in Xcode on devices of your choosing, there is an example UI
setup to access the picker.
UIPopupColorPicker is accessed through the single static function:
let _ = UIPopupColorPicker.show(on: self, block: nil)
This function returns an instance of BColorPicker in case you might want to
manipulate some of the controller manually.
let popup = UIPopupColorPicker.show(on: self, block: nil)
popup.tintColor = #colorLiteral(red: 0.1568514521,
green: 0.680490051,
blue: 0.9768045545,
alpha: 1)
popup.buttonFont = UIFont(name: "HelveticaNeue", size: 18.0)!
popup.colorList = [UIColor.gray, UIColor.blue, UIColor.yellow]
One way of handling color change is to implement a handler function
/// Handle a color selection from UIPopupColorPicker
func colorDidChange(to color: UIColor?) {
}
let _ = UIPopupColorPicker.show(on: self, block: colorDidChange)
or like this using an escaping closure
let _ = UIPopupColorPicker.show(on: self) { color in
// handle color change with escaping closure
}
see ViewController for a working example of the popup.
TL;DR do what you want with it.
UIPopupColorPicker is available under the MIT license. See the LICENSE file for more
info.