Contents

UISwipeGestureRecognizer

A discrete gesture recognizer that interprets swiping gestures in one or more directions.

Declaration

@MainActor class UISwipeGestureRecognizer

Mentioned in

Overview

UISwipeGestureRecognizer is a concrete subclass of UIGestureRecognizer.

UISwipeGestureRecognizer recognizes a swipe when the user moves the specified number of touches (numberOfTouchesRequired) in an allowable direction (direction) far enough to create a swipe. Swipes can be slow or fast. A slow swipe requires high directional precision but a small distance; a fast swipe requires low directional precision but a large distance. Because a swipe is a discrete gesture, the system sends the associated action message just once per gesture.

You can determine the location where a swipe begins by calling the UIGestureRecognizer methods location(in:) and location(ofTouch:in:). The former method provides the centroid if the gesture contains more than one touch; the latter provides the location of a particular touch.

Topics

Configuring the gesture

See Also

Standard gestures