I have a list that's inside a horizontal scroll view:
- horizontal scroll view
- list
- list row
- list row
- list row
- list
- list row
- list row
- list row
- list
- list row
- list row
- list row
- list
When I add swipe actions on list rows and try to use the app, the scroll view scrolls instead.
does anyone a solution to this?
Hello @yuval-nachman,
Thank you for your post.
It sounds like the .swipeActions aren’t being registered because that gesture is used to scroll horizontally for pagination.
If this is not the case, please provide more information and include a code snippet that reproduces the issue.
Because ScrollView’s pagination recognizer sits higher in the view hierarchy, the ScrollView claims the touch first. SwiftUI has no API for controlling gesture recognizer priority, like UIKit does with require(toFail:), which is for this exact scenario.
As a workaround, consider changing the input method for list row from a .swipeAction to a .contextMenu or button, or try using next/previous page buttons instead of swiping to change pages, since thats the same recognizer that .swipeActions works with. When it comes to designing UX, there is likely something in the Design HIG that applies to your use case: See Designing for iOS.
Lastly, hearing your use case would be useful in an Enhancement Request. If you file an enhancement request using Feedback Assistant, reply below with the Feedback number and I will make sure that report is seen by the relevant engineering team.
I hope this information is helpful,
Travis