Instance Method

addGestureRecognizer(_:)

Attaches a gesture recognizer to the view.

Declaration

func addGestureRecognizer(_ gestureRecognizer: UIGestureRecognizer)

Parameters

gestureRecognizer

An object whose class descends from the UIGestureRecognizer class. This parameter must not be nil.

Discussion

Attaching a gesture recognizer to a view defines the scope of the represented gesture, causing it to receive touches hit-tested to that view and all of its subviews. The view establishes a strong reference to the gesture recognizer.