An open API service indexing awesome lists of open source software.

https://github.com/tornikegomareli/simtouch

Send taps, swipes, and gestures to iOS Simulator from command line - built for LLM-driven testing
https://github.com/tornikegomareli/simtouch

ai-testing send-actions send-taps simulator

Last synced: 9 days ago
JSON representation

Send taps, swipes, and gestures to iOS Simulator from command line - built for LLM-driven testing

Awesome Lists containing this project

README

          

Simple command line tool for sending touch events to iOS Simulator.

Currntly Support for tap, swipe, and long press

## Installation

### Quick Install (Recommended)

Clone and install globally:
```bash
git clone https://github.com/yourusername/simtouch.git
cd simtouch
./install.sh
```

This will:
1. Build simtouch with optimizations
2. Install it to `/usr/local/bin`
3. Make it available globally as `simtouch`

### Manual Build

If you prefer to build without installing globally:
```bash
git clone https://github.com/yourusername/simtouch.git
cd simtouch
zig build -Doptimize=ReleaseSafe
```

The binary will be at `./zig-out/bin/simtouch`

## Usage

Make sure iOS Simulator is running before using simtouch.

### Usage

#### Tap
Send a single tap at specific coordinates:
```bash
simtouch tap 200 300
```

#### Swipe
Perform a swipe gesture from one point to another:
```bash
simtouch swipe 100 500 100 100
```

#### Long Press
Hold a touch for a specified duration (in milliseconds):
```bash
simtouch longpress 200 200 2000
```

### Coordinate System

- Coordinates are in pixels relative to the simulator window
- (0, 0) is the top-left corner of the device screen
- Example: iPhone 14 Pro is typically 393x852 pixels

## Why

The main idea behind it is to create a simple, lightweight tool that can be easily integrated with AI/LLM workflows through tool calling. I don't want to use complex automation frameworks, so this simple solution provides a minimal interface that LLMs can directly invoke to interact with.

### Use Cases
- **AI Testing** - Let LLMs explore and test your iOS apps autonomously
- Fuzzing Agents - Where a couple of agents are interacting the app simultaneously

## How

simtouch uses C's Core Graphics APIs to send mouse events to the Simulator window. The iOS Simulator automatically translates these mouse events into touch events for the running iOS application.

```
CGEvent (Mouse) → Simulator.app → UITouch → iOS App
```

## Examples

### Automation Script
```bash
#!/bin/bash
# Tap a button
simtouch tap 200 400

# Wait
sleep 1

# Swipe up
simtouch swipe 200 600 200 200

# Long press for context menu
simtouch longpress 150 300 1500
```

### Python Integration
```python
import subprocess

def tap(x, y):
subprocess.run(["simtouch", "tap", str(x), str(y)])

def swipe(x1, y1, x2, y2):
subprocess.run(["simtouch", "swipe",
str(x1), str(y1), str(x2), str(y2)])

# Example usage
tap(200, 300)
swipe(100, 500, 100, 100)
```

### Building with optimizations
```bash
zig build -Doptimize=ReleaseSafe
```

## Limitations
- Requires Simulator window to be visible
- Single touch only (no multi-touch gestures yet)

## Roadmap
- [ ] Multi-touch support (pinch, rotate)
- [ ] Element finding by accessibility label
- [ ] Record and replay functionality

## License
MIT License - see [LICENSE](LICENSE) file for details