Skip to content

Add gesture direction control functionality #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

noppefoxwolf
Copy link
Owner

Summary

  • Add ability to disable specific swipe directions (up, down, or all) in CardDeckView
  • Introduce CardDeckScrollDirection option set for configuring disabled directions
  • Add .cardDeckDisabledScrollDirections() view modifier for easy configuration
  • Update example app with interactive demo showing different gesture configurations

Key Features

  • Granular Control: Disable up swipes, down swipes, or all gestures independently
  • Simple API: Use .cardDeckDisabledScrollDirections(.up) to disable specific directions
  • Environment-based: Uses SwiftUI environment for propagating configuration
  • Backward Compatible: Existing code continues to work without changes

Test plan

  • Test normal gesture behavior (all enabled)
  • Test up swipe disabled configuration
  • Test down swipe disabled configuration
  • Test all gestures disabled configuration
  • Verify haptic feedback works correctly for enabled gestures
  • Confirm example app demonstrates all configurations properly

🤖 Generated with Claude Code

- Add CardDeckScrollDirection OptionSet with .up, .down, .vertical, .all options
- Implement cardDeckDisabledScrollDirections ViewModifier using @entry
- Add gesture filtering logic to disable specific swipe directions
- Update Example.swiftpm with interactive demo using Picker
- Use SwiftUI .gesture(isEnabled:) API for efficient gesture control
- Maintain card state when switching between different gesture modes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@noppefoxwolf noppefoxwolf merged commit 35a06f9 into main Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant