Class

UISwipeGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for swiping gestures in one or more directions.

Overview

A swipe is a discrete gesture, and thus the associated action message is sent only once per gesture. UISwipeGestureRecognizer recognizes a swipe when the specified number of touches (numberOfTouchesRequired) have moved mostly in an allowable direction (direction) far enough to be considered 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.

You may determine the location where a swipe began by calling the UIGestureRecognizer methods location(in:) and location(ofTouch:in:). The former method gives you the centroid if more than one touch was involved in the gesture; the latter gives the location of a particular touch.

Topics

Configuring the Gesture

var direction: UISwipeGestureRecognizerDirection

The permitted direction of the swipe for this gesture recognizer.

var numberOfTouchesRequired: Int

The number of touches that must be present for the swipe gesture to be recognized.

Constants

struct UISwipeGestureRecognizerDirection

The direction of the swipe.

Relationships

Inherits From

Conforms To

See Also

UIKit Gestures

Handling UIKit Gestures

Use gesture recognizers to simplify touch handling and create a consistent user experience.

Coordinating Multiple Gesture Recognizers

Discover how to use multiple gesture recognizers on the same view.

class UILongPressGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for long-press gestures.

class UIPanGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for panning (dragging) gestures.

class UIPinchGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for pinching gestures involving two touches.

class UIScreenEdgePanGestureRecognizer

A gesture recognizer that looks for panning (dragging) gestures that start near an edge of the screen.

class UIRotationGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for rotation gestures involving two touches.

class UITapGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for single or multiple taps.