Skip to content

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

Open
saphid wants to merge 3 commits into
pingdotgg:t3code/rebuild-mobile-app-swiftfrom
saphid:saphid/swiftui-thread-swiping-scrolling
Open

fix(swift-ios): restore thread scrolling and back swipe#6090
saphid wants to merge 3 commits into
pingdotgg:t3code/rebuild-mobile-app-swiftfrom
saphid:saphid/swiftui-thread-swiping-scrolling

Conversation

@saphid

@saphid saphid commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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
Touch handling is centralized on the window root with nuanced scroll-view and text-input edge cases; behavior is well tested but still interaction-critical on thread detail.

Overview
Replaces the thread detail SwiftUI DragGesture (left-edge-only back swipe) with a ThreadBackSwipeGestureView that installs a UIKit UIPanGestureRecognizer on the window root, scoped to the thread surface and compact width only.

The new ThreadBackSwipeGesture policy rejects vertical pans at recognition time so the transcript collection view keeps vertical scrolling, triggers back when a rightward pan reaches 72pt with a 1.4× horizontal-to-vertical ratio, runs simultaneously with vertical scroll views but only shares horizontal nested scrollers at their leading edge, and skips UITextField / first-responder UITextView so text editing keeps horizontal drags. The recognizer is tied to the representable lifecycle (install/uninstall on window changes).

TranscriptViewportGeometryTests gains unit coverage for begin/navigate thresholds, scroll-edge gating, touch routing, and text-input exclusion.

Reviewed by Cursor Bugbot for commit a45c0ed. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Restore thread back-swipe and scrolling in iOS by replacing SwiftUI gesture with UIKit pan recognizer

  • Removes the SwiftUI DragGesture edge-swipe handler from ThreadDetailView and replaces it with a UIKit UIPanGestureRecognizer installed on the window's root view controller via a new ThreadBackSwipeGestureView UIViewRepresentable.
  • The new gesture uses ThreadBackSwipeGesture heuristics: requires rightward, predominantly horizontal motion (ratio 1.4) with ≥72pt translation, allows simultaneous recognition with vertical scroll views, and cooperates with horizontal scrollers only at their leading edge.
  • Touch reception is filtered to exclude editable/active text inputs and suppressed when a view controller is presented, scoping the gesture to the representable's frame.
  • The gesture is only enabled in compact horizontal size class (iPhone layout).
  • Behavioral Change: back-swipe is now recognized from anywhere on the screen surface, not just within 24pt of the leading edge.

Macroscope summarized a45c0ed.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

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: a147cbc7-3e5a-4c20-8383-f022d8266cce

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.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 11, 2026
@saphid

saphid commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Reviewed by Cursor Bugbot for commit 4863570. Configure here.

Comment thread apps/swift-ios/Features/Chat/ThreadDetailView.swift
@macroscopeapp

macroscopeapp Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR fundamentally reimplements the back-swipe gesture system, replacing a simple SwiftUI DragGesture with a complex 245-line native UIPanGestureRecognizer implementation. Despite good test coverage, the significant changes to core navigation/scrolling interactions warrant human review to verify UX behavior.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant