Skip to main content

Screen:swipe()

Perform a single-finger swipe on the screen. The swipe path is defined by a list of SwipePoint values that the finger moves through sequentially.

Signature

Screen:swipe(swipePoints: List<SwipePoint>, params?: SwipeParams): void

Returns

void

Parameters

ParameterTypeDescription
swipePointsList<SwipePoint>A list of points the finger moves through. Minimum 2 points.
paramsSwipeParamsOptional. Controls swipe behavior such as continuous mode and delay.

SwipePoint Behavior

Each point in the list is a SwipePoint(x, y, holdDuration, swipeDuration). The meaning depends on the point's position:

First point (start position):

  • swipeDuration — Initial delay in milliseconds before the finger touches down
  • holdDuration — How long to hold at the start position before moving to the next point

Subsequent points (move targets):

  • swipeDuration — Duration in milliseconds to travel from the previous point to this point
  • holdDuration — How long to hold at this point after arriving (pause before next move)

Last point:

  • holdDuration — Trailing hold at the final position before the finger lifts

Examples

Simple swipe

Screen:swipe({
SwipePoint(500, 1200, 50, 0),
SwipePoint(500, 400, 50, 1000),
})

The finger touches down at (500, 1200) immediately, holds 50ms, then swipes up to (500, 400) over 1 second.

Swipe with initial delay

Screen:swipe({
SwipePoint(300, 800, 50, 2000),
SwipePoint(700, 800, 50, 1500),
})

Waits 2 seconds, then touches down at (300, 800), holds 50ms, and swipes right to (700, 800) over 1.5 seconds.

Multi-point swipe with hold

Screen:swipe({
SwipePoint(100, 500, 50, 0),
SwipePoint(400, 500, 3000, 1000),
SwipePoint(400, 900, 50, 1000),
})

Timeline:

TimeAction
0msPress down at (100, 500)
50msStart moving to (400, 500)
1050msArrive at (400, 500), hold for 3000ms
4050msStart moving to (400, 900)
5050msArrive at (400, 900), hold 50ms
5100msFinger lifts

The finger swipes right, pauses for 3 seconds, then swipes down.

Continuous swipe with SwipeParams

Screen:swipe({
SwipePoint(200, 600, 50, 0),
SwipePoint(500, 300, 50, 2000),
}, SwipeParams():setContinue(true))

When setContinue(true) is set, the finger does not lift between swipe points. This enables smooth continuous gestures on Android 8.1+ with Accessibility Service. On Native Service, swipes are always continuous regardless of this setting.

Slow drag

Screen:swipe({
SwipePoint(540, 1800, 100, 0),
SwipePoint(540, 600, 50, 5000),
})

Touches down at (540, 1800), holds 100ms, then slowly drags up to (540, 600) over 5 seconds.