# karagoz swipe

Moves one finger from (x1, y1) to (x2, y2).

- Android emulator Done
- Android device Done
- iOS simulator Done
- iOS device Done

## Usage

```console title="~/app"
karagoz swipe <x1> <y1> <x2> <y2> [--duration <ms>] [--device <id>]
```

## Before you start

- On Android, for input to reach apps: the screen unlocked.
- On an iOS simulator: Xcode 27 or newer, opened once.
- On an iPhone: paired with the Mac, Developer Mode on, connected by USB cable, Settings > Developer > Enable UI Automation on, and Karagöz’s runner installed with [`install-runner`](https://karagozmcp.com/docs/commands/install-runner/).

## Options

| Option                | Default                                                               | Meaning                                                                                |
| --------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `<x1> <y1> <x2> <y2>` |                                                                       | [Screen pixels](https://karagozmcp.com/docs/output/#coordinates), same rules as `tap`. |
| `--duration <ms>`     | `300`                                                                 | Time from start to end. Whole milliseconds, 0 to 999999999.                            |
| `--device <id>`       | see [Device selection](https://karagozmcp.com/docs/device-selection/) |                                                                                        |

## Examples

### Swipe between two points

```console title="~/app"
$ karagoz swipe 540 1800 540 600
{"device":"emulator-5554","x1":540,"y1":1800,"x2":540,"y2":600,"duration":300}
```

## Output

```json
{
  "device": "27024DC1-EDB0-4BF2-8010-08FE3936BAB6",
  "x1": 603,
  "y1": 2228,
  "x2": 603,
  "y2": 917,
  "duration": 300
}
```

On an iOS simulator the arguments and output are the same, with the same default duration. On an iPhone too, through Karagöz’s runner.

- `device` string: Serial, or the simulator's or iPhone's UDID.
- `x1` number: The finger moves from `(x1, y1)` to `(x2, y2)`. [Screen pixels](https://karagozmcp.com/docs/output/#coordinates), same rules as `tap`.
- `y1` number: The finger moves from `(x1, y1)` to `(x2, y2)`. Screen pixels, same rules as `tap`.
- `x2` number: The finger moves from `(x1, y1)` to `(x2, y2)`. Screen pixels, same rules as `tap`.
- `y2` number: The finger moves from `(x1, y1)` to `(x2, y2)`. Screen pixels, same rules as `tap`.
- `duration` number: Time from start to end, in whole milliseconds. Always present, including the default `300`.

On an iPhone the duration is played as given.

The first of `ui-tree`, `tap`, `swipe`, `text` or `key` on a simulator compiles a small [helper](https://karagozmcp.com/docs/requirements/#cache-folder), which takes a few seconds.

## Duration matters

A fast swipe flings a list and a slow one drags it:

| `--duration` | Android, 1200 px drag: further scroll after the finger lifts | iPhone, 1398 px drag up a list: how far the list moves |
| ------------ | ------------------------------------------------------------ | ------------------------------------------------------ |
| 300 ms       | 1059 px                                                      | flung out of view                                      |
| 1000 ms      | 131 px                                                       | 1318 px                                                |
| 3000 ms      | 19 px                                                        | 1354 px                                                |

## Errors

A swipe can get [`INVALID_ARGS`](https://karagozmcp.com/docs/error-codes/#invalid-args), [`INPUT_BLOCKED`](https://karagozmcp.com/docs/error-codes/#input-blocked), the [device selection errors](https://karagozmcp.com/docs/device-selection/#errors) and the adb errors.

On a simulator, as for [`tap`](https://karagozmcp.com/docs/commands/tap/#on-an-ios-simulator):

- [`NOT_SUPPORTED`](https://karagozmcp.com/docs/error-codes/#not-supported) with Xcode 26 or older.
- [`DEVICE_NOT_READY`](https://karagozmcp.com/docs/error-codes/#device-not-ready) when the input service does not answer within 4 s (a simulator that has just booted).
- [`HELPER_FAILED`](https://karagozmcp.com/docs/error-codes/#helper-failed).

On an iPhone, the errors of [`tap` on an iPhone](https://karagozmcp.com/docs/commands/tap/#on-an-iphone).

## MCP equivalent

MCP equivalent `swipe {"x1":540,"y1":1800,"x2":540,"y2":600}` [MCP tools](https://karagozmcp.com/docs/mcp/#tools)

Arguments: `x1`, `y1`, `x2`, `y2` (required), `duration`, `device`. The names are the CLI's option and positional names.

## Related commands

- [karagoz tap](https://karagozmcp.com/docs/commands/tap/): Its iOS sections list the errors swipe gets on a simulator and on an iPhone.
