ColorSliderPreviewing
public protocol ColorSliderPreviewing
A protocol defining callback methods for a ColorSlider preview view.
To create a custom preview view, create a UIView subclass and implement ColorSliderPreviewing.
Then, create an instance of your custom preview view and pass it to the ColorSlider initializer.
As a user drags their finger, ColorSlider will automatically set your preview view’s center
to the point closest to the touch, centered along the axis perpendicular to the ColorSlider‘s orientation.
If autoresizesSubviews is true (the default value on all UIViews) on your ColorSlider, your preview view
will also be automatically resized when its center point is being set. To disable resizing your preview, set
the autoresizesSubviews property on your ColorSlider to false.
-
Called when the color of the slider changes, so the preview can respond correctly.
Declaration
Swift
func colorChanged(to color: UIColor)Parameters
colorThe newly selected color.
-
Called when the preview changes state and should update its appearance appropriately. Since
ColorSlidersets thecenterof your preview automatically, you should use your view’stransformto adjust or animate most changes. SeeDefaultPreviewViewfor an example.Declaration
Swift
func transition(to state: PreviewState)Parameters
stateThe new state of the preview view.
View on GitHub
Install in Dash
ColorSliderPreviewing Protocol Reference