A concrete subclass of UIGesture
that looks for swiping gestures in one or more directions.
SDKs
- iOS 3.2+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
class UISwipeGestureRecognizer : UIGesture Recognizer
Overview
A swipe is a discrete gesture, and thus the associated action message is sent only once per gesture. UISwipe
recognizes a swipe when the specified number of touches (number
) 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 UIGesture
methods location(in:)
and location(of
. 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.