Skip to content

let your agent control your phone

scroll/swipe: each verb keeps the convention its own word carries

ShawnPana0ff3b63abba1
diff --git a/SKILL.md b/SKILL.md
index 268fb68..5b48875 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -75,17 +75,29 @@ PY
achieved. Only you know what you were after, so judge from the content you
expected, not from a number looking big or small.
- Navigation: `home()`, `app_switcher()`, `open_app("Notes")` (Spotlight),
- `scroll("down")`, `swipe("down")`, `type_text("...")`, `press("return")`,
+ `scroll("down")`, `swipe("up")`, `type_text("...")`, `press("return")`,
`long_press(x, y)`.
-- **Directions name what you want to SEE, for every gesture that takes one**
- (`scroll`, `swipe`, `scroll_screen`, `scroll_until`, `scroll_collect`):
- `"down"` reveals content further down a list or the next item in a feed,
- `"up"` goes back towards the start, and `"left"`/`"right"` work the same way
- sideways.
-
- **This is the opposite of what these words used to mean.** They used to name
- finger motion, so the old `swipe("up")` — finger up — is today's
- `swipe("down")`. Existing scripts saying `"up"` will now scroll backwards.
+- **Directions: `scroll` says what you want to SEE, `swipe` says which way the
+ finger goes.** They disagree on purpose, because English does — "scroll down
+ the page" and "swipe up for the next video" describe the same outcome.
+
+ ```
+ scroll("down") show me what is further down
+ swipe("up") thumb up (the phrasing everyone uses for "next")
+ ```
+
+ `scroll`, `scroll_screen`, `scroll_until` and `scroll_collect` all take the
+ content-direction; only `swipe` takes finger motion. `"left"`/`"right"` work
+ on both.
+
+ **Use `scroll` for anything scrollable.** On macOS 26 a vertical touch-drag is
+ dropped, so `swipe("up")`/`swipe("down")` move nothing in a list or a feed --
+ measured on Settings and on TikTok. Horizontal still works, so `swipe("left")`
+ / `swipe("right")` remain the way to flip Home Screen pages and carousels,
+ which a scroll cannot do.
+
+ **Breaking change for `scroll`:** it used to take finger motion too, so the
+ old `scroll("up")` is today's `scroll("down")`. `swipe` is unchanged.
- **Scrolling**: `scroll(direction, amount, at=...)` for one gesture;
`scroll_until(done)` to stop when your predicate on the visible OCR is met;
`scroll_collect(extract, key=...)` to walk a list, de-duping as it goes.
diff --git a/src/phone_harness/helpers.py b/src/phone_harness/helpers.py
index 364a7f5..6e69b7e 100644
--- a/src/phone_harness/helpers.py
+++ b/src/phone_harness/helpers.py
@@ -305,23 +305,33 @@ def _delta(direction, amount, win):
def swipe(direction, distance=0.4, at=None):
- """swipe('up'|'down'|'left'|'right') — a momentum touch-drag, centred.
+ """swipe('up'|'down'|'left'|'right') — a momentum touch-drag.
- `direction` is what you want to SEE, matching scroll(): swipe('down')
- reveals content further down, swipe('right') what is off to the right.
- This used to mean finger motion, which is the opposite; the two verbs
- disagreeing on the same word was a trap worth removing.
+ `direction` is FINGER MOTION, which is the opposite of scroll()'s: this is
+ the one place the two verbs deliberately disagree, because English does.
+ "swipe up for the next video" means the thumb goes up; "scroll down the
+ page" means show me what is below. Both describe the same outcome, and
+ each function follows the convention its own word already carries.
+
+ swipe("up") thumb up (how everyone says "next")
+ scroll("down") see below
+
+ Use scroll() for anything scrollable. On macOS 26 a vertical touch-drag is
+ dropped by iPhone Mirroring, so swipe("up")/swipe("down") move nothing in a
+ list or a feed -- measured on Settings and on TikTok. Horizontal survives,
+ so swipe("left")/swipe("right") stay the way to flip Home Screen pages and
+ carousels, which a scroll cannot do.
+
+ `at` aims the gesture; defaults to the window centre.
"""
w = _win()
cx, cy = _point(at, w)
- sx, sy = _DIRECTIONS.get(direction, (0, 0))
- # The finger travels the same way as the scroll delta: to bring content
- # from further down into view, the finger moves up the screen.
- dx = sx * w["w"] * distance
- dy = sy * w["h"] * distance
+ dx = {"left": -1, "right": 1}.get(direction, 0) * w["w"] * distance
+ dy = {"up": -1, "down": 1}.get(direction, 0) * w["h"] * distance
if not dx and not dy:
raise ValueError(
- f"direction must be one of {sorted(_DIRECTIONS)}, got {direction!r}")
+ f"direction must be one of ['down', 'left', 'right', 'up'], "
+ f"got {direction!r}")
# Fast, short drag = a momentum flick. A slow drag barely registers on iOS
# (it won't even flip a Home-Screen page); the flick is what snaps pages
# and carousels. For scrolling lists use scroll()/scroll_collect() instead.