UIGestureRecognizer

extension UIGestureRecognizer
  • Convenience initializer, associating an action closure with the gesture recognizer (instead of the more traditional target/action).

    Declaration

    Swift

    public convenience init(action: @escaping (UIGestureRecognizer) -> Void)

    Parameters

    action

    The closure for the recognizer to execute. There is no pre-logic to conditionally invoke the closure or not (e.g. only invoke the closure if the gesture recognizer is in a particular state). The closure is merely invoked directly; all handler logic is up to the closure.

    Return Value

    The UIGestureRecognizer.