swiftui-gestures

Implement and debug SwiftUI gestures with composition and GestureState management.

1.1k|81|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/CharlesWiltgen/Axiom --skill swiftui-gestures
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-gestures
Source: https://github.com/CharlesWiltgen/Axiom/tree/main/.claude-plugin/plugins/axiom/skills/swiftui-gestures
Command: npx skills add https://github.com/CharlesWiltgen/Axiom --skill swiftui-gestures

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide covers SwiftUI gestures, their composition, state management, accessibility, and cross-platform considerations.

Core Features & Use Cases

  • Tap, drag, long press, magnification, and rotation gestures
  • Gesture composition patterns: simultaneous, sequenced, exclusive
  • Accessible gestures and VoiceOver integration

Quick Start

Prompt: "Combine drag and tap gestures on a card and preserve accessibility."

Frequently Asked Questions about swiftui-gestures

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement drag gestures in SwiftUI?

Drag gestures in SwiftUI use DragGesture with onChanged and onEnded handlers to track movement. Attach it to a view with .gesture(DragGesture()...), manage state with GestureState for temporary values, and reset state when the gesture ends for clean state management.

Can I combine multiple gestures on the same SwiftUI view?

Yes, SwiftUI supports gesture composition through simultaneous, sequenced, and exclusive patterns. Use .simultaneously(with:) to recognize gestures together, chain gestures for ordering, or use exclusive composition when only one gesture should activate to avoid conflicts.

How do I make SwiftUI gestures accessible with VoiceOver?

Accessible gestures require adding accessibility labels and hints to views, using custom accessibility actions for complex interactions, and testing with VoiceOver on iOS and macOS. Ensure tap, drag, and long-press gestures have clear accessibility descriptions for screen reader users.

What gestures does SwiftUI support across iOS, macOS, and visionOS?

SwiftUI provides tap, drag, long-press, magnification, and rotation gestures. Tap and long-press work consistently across platforms, while drag, magnification, and rotation adapt to input methods—touch on iOS, trackpad or mouse on macOS, and hand tracking on visionOS.

Why isn't my SwiftUI gesture state updating correctly?

Gesture state updates fail when using wrong semantics: use GestureState for temporary state during recognition and onEnded for permanent changes. Avoid updating @State directly inside gesture handlers; GestureState automatically resets when the gesture ends, preventing stale values.

How do I handle tap and drag gestures together on a card?

Combine tap and drag using simultaneous or exclusive composition. Use .simultaneously(with:) if both should work together, or exclusive composition if only one should activate. Manage separate state for each gesture and reset it on gesture completion to preserve distinct behaviors.