ColorPickerDelegate
@objc(HBColorPickerDelegate)
public protocol ColorPickerDelegate : NSObjectProtocol
Use ColorPickerDelegate to handle the user’s response to ColorPickerViewController.
-
Informs the delegate that the user has selected a color in the color picker. Optional.
Use this to update your user interface with the new color value, if suitable to your use case.
You should, at minimum, implement either this method or
colorPicker(_:didAccept:). If you don’t intend to implement this method, it is expected that you implementcolorPicker(_:didAccept:). If you implement this method and the user selects Cancel, this method will be called with the initial color passed in viaColorPickerConfiguration.colorto undo the selection.Declaration
Swift
@objc(colorPicker:didSelectColor:) optional func colorPicker(_ colorPicker: ColorPickerViewController, didSelect color: UIColor)Parameters
colorPickerThe
ColorPickerViewControllerinstance that triggered the action.colorThe
UIColorselection the user made. -
Informs the delegate that the user has dismissed the color picker with a positive response, having selected the selected color. Optional.
You should, at minimum, implement either this method or
colorPicker(_:didSelect:).Declaration
Swift
@objc(colorPicker:didAcceptColor:) optional func colorPicker(_ colorPicker: ColorPickerViewController, didAccept color: UIColor)Parameters
colorPickerThe
ColorPickerViewControllerinstance that triggered the action.colorThe
UIColorselection the user made. -
Informs the delegate that the user has dismissed the color picker with a negative response. Optional.
You usually do not need to handle this condition.
Declaration
Swift
@objc(colorPickerDidCancel:) optional func colorPickerDidCancel(_ colorPicker: ColorPickerViewController)Parameters
colorPickerThe
ColorPickerViewControllerinstance that triggered the action.
View on GitHub
Install in Dash
ColorPickerDelegate Protocol Reference