Inherits from LeapGesture : NSObject
Declared in LeapObjectiveC.h

Overview

The LeapSwipeGesture class represents a swiping motion of a finger or tool.

Important: To use swipe gestures in your application, you must enable
recognition of the swipe gesture. You can enable recognition with:

    [controller enableGesture:LEAP_GESTURE_TYPE_SWIPE enable:YES];  

Swipe gestures are continuous. The LeapSwipeGesture objects for the gesture have
three possible states:

  • LEAP_GESTURE_STATE_START – The gesture has just started.
  • LEAP_GESTURE_STATE_UPDATE – The swipe gesture is continuing.
  • LEAP_GESTURE_STATE_STOP – The swipe gesture is finished.

You can set the minimum length and velocity required for a movement
to be recognized as a swipe using the config attribute of a connected
LeapController object. Use the following keys to configure swipe recognition:

Key string Value type Default value Units
Gesture.Swipe.MinLength float 150 mm
Gesture.Swipe.MinVelocity float 1000 mm/s

The following example demonstrates how to set the swipe configuration
parameters:

    if([controller.config setFloat:@"Gesture.Swipe.MinLength" value:200.0] &&  
       [controller.config setFloat:@"Gesture.Swipe.MinVelocity" value:750])  
        [controller.config save];

Tasks

Instance Methods

direction

The unit direction vector parallel to the swipe motion.

- (LeapVector *)direction

Return Value

LeapVector The unit direction vector representing the swipe
motion.

Discussion

The unit direction vector parallel to the swipe motion.

You can compare the components of the vector to classify the swipe as
appropriate for your application. For example, if you are using swipes
for two dimensional scrolling, you can compare the x and y values to
determine if the swipe is primarily horizontal or vertical.

Declared In

LeapObjectiveC.h

pointable

The finger or tool performing the swipe gesture.

- (LeapPointable *)pointable

Return Value

A LeapPointable object representing the swiping finger
or tool.

Discussion

The finger or tool performing the swipe gesture.

Declared In

LeapObjectiveC.h

position

The current position of the swipe.

- (LeapVector *)position

Return Value

LeapVector The current swipe position within the Leap frame of
reference, in mm.

Discussion

The current position of the swipe.

Declared In

LeapObjectiveC.h

speed

The swipe speed in mm/second.

- (float)speed

Return Value

float The speed of the finger performing the swipe gesture in
millimeters per second.

Discussion

The swipe speed in mm/second.

Declared In

LeapObjectiveC.h

startPosition

The position where the swipe began.

- (LeapVector *)startPosition

Return Value

LeapVector The starting position within the Leap frame of
reference, in mm.

Discussion

The position where the swipe began.

Declared In

LeapObjectiveC.h