Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(swift-ios): restore thread scrolling and back swipe #6090

Mergedsaphid(GitHub profile, opens in a new tab)merged 4 commits intot3code/rebuild-mobile-app-swift fromrefs/pull/6090/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

What Changed

  • replace the thread-level SwiftUI DragGesture with a native UIKit UIPanGestureRecognizer
  • fail the back recognizer as soon as motion is vertical so transcript scrolling keeps ownership anywhere on screen
  • allow rightward back swipes across the full thread surface, while preserving nested horizontal scrollers away from their leading edge
  • scope and remove the window-hosted recognizer with the thread view lifecycle
  • add focused coverage for vertical, horizontal, diagonal, slow, and nested-scroll gesture policy

Why

The broad SwiftUI gesture attached to ThreadDetailView competed with the transcript collection view. In practice, vertical scrolling was only reliable when the gesture began near the top of the window, while the native navigation gesture only worked from the screen edge.

UIKit gesture-recognizer arbitration lets the back gesture reject vertical pans before recognition and cooperate with child scroll views explicitly. That restores native scrolling ownership and makes the requested full-surface back swipe reliable without stealing horizontal child scrolling.

This is a focused child PR for #5178 and targets its owner branch.

UI Changes

There is no visual appearance change; this changes touch interaction only.

Verified on a physical iPhone with the final implementation: transcript scrolling works from the full thread surface and a rightward swipe returns to the thread list from anywhere on screen. The reporter completed the device acceptance pass.

Verification

  • TranscriptViewportGeometryTests: 10/10 passed on iPhone 17 Pro Simulator
  • apps/swift-ios/Scripts/ci-test.sh: the changed gesture suite passed; the script exits 65 because five HomeThreadMetadataTests assertions already fail identically on the owner branch at f98cab553
  • fresh read-only Claude Opus 5 high review of rebased commit 4863570f3: exit 0, no blocking defects
  • git diff --check upstream/t3code/rebuild-mobile-app-swift...HEAD: passed

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after screenshots are not applicable because appearance is unchanged
  • I included a video for animation/interaction changes

Implemented with GPT-5.6 Sol in T3 Code/Codex. Independently reviewed by Claude Opus 5 high.


Note

Medium Risk Touches core navigation and scroll gesture arbitration by installing a window-level pan recognizer, which can regress scrolling, text selection, or nested horizontal pans if heuristics are wrong.

Overview Replaces the thread detail SwiftUI DragGesture back-swipe with a native UIKit UIPanGestureRecognizer, so transcript scrolling no longer fights the navigation gesture.

The new ThreadBackSwipeGesture / ThreadBackSwipeGestureView installs on the window root, fails vertical pans immediately, and allows full-surface rightward back swipes while still deferring to editable text and nested horizontal scrollers away from their leading edge. Compact size class only.

Adds focused unit coverage for vertical, horizontal, diagonal, slow, and nested-scroll gesture policy.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit dd6ac86ee85b137aca53ad6d57c90dd78195fb39. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix thread scrolling and back swipe in iOS by replacing SwiftUI gesture with native UIPanGestureRecognizer

  • Removes the SwiftUI DragGesture-based back navigation from ThreadDetailView and replaces it with a ThreadBackSwipeGestureView that installs a native UIPanGestureRecognizer on the window's root view.
  • The new gesture logic (in ThreadBackSwipeGesture) cooperates with vertical and horizontal scroll views, only triggering navigation on rightward, predominantly-horizontal pans that exceed a minimum translation of 72pt.
  • Touch receipt is scoped to exclude editable text fields and horizontal scrollers not at the leading edge, fixing conflicts that broke thread scrolling.
  • Adds unit tests in TranscriptViewportGeometryTests covering begin, end, simultaneous recognition, and touch-receipt rules for the new gesture.
  • Behavioral Change: back swipe is now only enabled in compact width (horizontalSizeClass == .compact) and fires via a host-level recognizer rather than a SwiftUI gesture overlay.
Macroscope summarized dd6ac86.

Delivery: direct Validated against Theo commit: f98cab553546558e28d6e22f3dbe9807ecc3325f Depends on: none Merge order: this PR only Validation status: Mergeable; native/repository checks and current review are green. The unrelated Vercel authorization failure is a maintainer-side gate.

    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 93fddb2b-94a6-43a9-944c-6b4431d05377

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. CI baseline note: the failing Contract fixtures and native tests job reports only the same five HomeThreadMetadataTests assertions already failing on the owner branch. The owner branch run for base SHA f98cab553 also fails: https://github.com/pingdotgg/t3code/actions/runs/31442398563. I also reproduced those exact five assertions locally on detached base f98cab553; the 10 focused transcript/back-swipe tests pass on this PR.

    4. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4863570f32c17f1e2bab9553055e62ad0b10e16c. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR replaces a simple SwiftUI DragGesture with ~230 lines of new UIKit gesture handling code, including complex touch routing and simultaneous recognition logic. While intended as a bug fix, the scope of the reimplementation and its impact on core navigation interaction warrants human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    6. one blocking gesture interaction issue remains.

    7. t3-code-bot[bot](GitHub profile, opens in a new tab) approved these changes

      correction after independent review: the earlier text-drag concern overlooked the explicit touch filtering for UITextField and editable/first-responder UITextView descendants. the recognizer also handles nested horizontal scrollers and lifecycle removal. approved.

Sign in to join this conversation.