Skip to content

Add GestureState support#907

Merged
Kyle-Ye merged 2 commits into
mainfrom
feature/gesture_state
Jun 11, 2026
Merged

Add GestureState support#907
Kyle-Ye merged 2 commits into
mainfrom
feature/gesture_state

Conversation

@Kyle-Ye

@Kyle-Ye Kyle-Ye commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Add GestureState and GestureStateGesture support.

@github-actions github-actions Bot added area: event-gesture Events, gestures, tracing, or interaction plumbing. type: feature New API, behavior, platform support, or user-facing capability. labels Jun 11, 2026
@Kyle-Ye Kyle-Ye marked this pull request as ready for review June 11, 2026 17:30
@augmentcode

augmentcode Bot commented Jun 11, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Adds SwiftUI-compatible transient gesture state tracking to OpenSwiftUI via a new @GestureState property wrapper and an updating gesture modifier.

Changes:

  • Introduces GestureState<Value> as a DynamicProperty backed by State, with configurable reset behavior via a fixed Transaction or a reset closure.
  • Adds Gesture.updating(_:body:) to attach an updating callback that mutates a transient state value as gesture values change.
  • Implements GestureStateGesture<Base, State> as a PrimitiveGesture wrapper around an originating gesture.
  • Introduces an internal GestureStatePhase rule that drives updates, tracks reset seeds, and resets the state when the gesture ends/fails or when the attribute is removed.
  • Marks the phase attribute as transactional/removable and opts into changed-callback handling via input options.
  • Adds a small test suite covering basic wrapper behavior and that updating produces a GestureStateGesture.

Technical Notes: The implementation uses AttributeGraph rules (ResettableGestureRule, RemovableAttribute) and enqueues state writes via Update and/or GestureGraph depending on inputs.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread Sources/OpenSwiftUI/Event/Gesture/GestureState.swift
Comment thread Sources/OpenSwiftUI/Event/Gesture/GestureState.swift
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 17.44186% with 71 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.23%. Comparing base (f37859d) to head (e94474c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...urces/OpenSwiftUI/Event/Gesture/GestureState.swift 17.44% 71 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #907      +/-   ##
==========================================
- Coverage   26.27%   26.23%   -0.05%     
==========================================
  Files         710      712       +2     
  Lines       49719    49873     +154     
==========================================
+ Hits        13065    13085      +20     
- Misses      36654    36788     +134     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Kyle-Ye Kyle-Ye merged commit 4541430 into main Jun 11, 2026
8 checks passed
@Kyle-Ye Kyle-Ye deleted the feature/gesture_state branch June 11, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: event-gesture Events, gestures, tracing, or interaction plumbing. type: feature New API, behavior, platform support, or user-facing capability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant