A gesture recognizer that interprets swiping gestures in one or more directions.
- watchOS 3.0+
A swipe is a discrete gesture; the associated action message is sent only once per gesture.
You do not create instances of this class programmatically. Instead, add a swipe gesture recognizer to your Watch app’s storyboard file, dropping it onto a specific interface object. Touches occurring within the bounds of that interface object are tracked by the gesture recognizer and reported to an action method you define on the parent interface controller. For information on defining your action method and connecting it to your gesture recognizer, see
State Changes for a Swipe Gesture
A swipe gesture recognizer tracks discrete events, and therefore has a limited number of state changes. The swipe gesture is recognized when a single touch has moved mostly in an allowable 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.
The gesture recognizer calls its action method when it enters the WKGestureRecognizerStateRecognized state. You may determine the location where a swipe began by calling its
location method. For more information on implementing discrete gesture recognizers, see
Interface Builder Attributes
Xcode lets you configure information about your gesture recognizer in your storyboard file. Table 1 lists the attributes you can configure in your storyboard and their meaning.
The direction of the swipe. The swipe must occur in this direction for the gesture to be recognized. You can set this value programmatically using the