TheBestClockVerticalBrightnessSliderView

@IBDesignable
class TheBestClockVerticalBrightnessSliderView : UIControl

This is a special control that is normally invisible, and appears when the user starts a vertical pan. We use this to act as a brigthness slider for the clock. The top is the brightest, the bottom is the darkest. The view is updated with the current color from the main controller as it is panned.

  • This is how much space we have around the control. The hit rect will be the entire control, but the slider will be inset by this much.

    Declaration

    Swift

    private let _paddingInDisplayUnits: CGFloat
  • This is the gradient fill layer.

    Declaration

    Swift

    private var _gradientLayer: CAGradientLayer!
  • This is set to true, when the control is first shown.

    Declaration

    Swift

    private var _firstTime: Bool
  • These are the top color and brightness.

    Declaration

    Swift

    @IBInspectable
    var endColor: UIColor
  • Brightness level (changes)

    Declaration

    Swift

    @IBInspectable
    var brightness: CGFloat
  • This draws an “elongated upside-down teardrop” that appears while the control is being manipulated. The fill color is the current selected value.

    Declaration

    Swift

    override func draw(_ inRect: CGRect)

    Parameters

    inRect

    ignored

  • This is called when the user first begins a slide.

    -returns true, if the drag is approved.

    Declaration

    Swift

    override func beginTracking(_ inTouch: UITouch, with inEvent: UIEvent?) -> Bool

    Parameters

    inTouch

    The initial touch object.

    with

    The event for this touch.

  • This is called when there are touch (not necessarily pan) events on the slider.

    Declaration

    Swift

    override func touchesBegan(_ inTouches: Set<UITouch>, with inEvent: UIEvent?)

    Parameters

    inTouches

    The initial touch object[s].

    with

    The event for this touch.

  • This is called repeatedly during a slide.

    -returns true, if the drag is approved.

    Declaration

    Swift

    override func continueTracking(_ inTouch: UITouch, with inEvent: UIEvent?) -> Bool

    Parameters

    inTouch

    The initial touch object.

    with

    The event for this touch.

  • This is called at the end of the pan.

    Declaration

    Swift

    override func endTracking(_ inTouch: UITouch?, with inEvent: UIEvent?)

    Parameters

    inTouch

    The initial touch object.

    with

    The event for this touch.

  • This is called if the tracking was canceled.

    Declaration

    Swift

    override func cancelTracking(with inEvent: UIEvent?)

    Parameters

    with

    The event for the cancel.

Catalyst Cleaner