Reputation: 3393
In my collection view, I want to be able to do a two-finger swipe to initiate edit mode and begin selecting rows. I do this by setting allowsSelectionDuringEditing
and allowsMultipleSelectionDuringEditing
to true
, and I return true
from the collectionView(_:shouldBeginMultipleSelectionInteractionAt:)
delegate method.
For the most part, this works fine. The problem comes when using a trackpad.
A one-finger trackpad click also triggers the collectionView(_:shouldBeginMultipleSelectionInteractionAt:)
callback. Not only is this not the way I want to initiate selection, it also blocks being able use the trackpad to tap on a cell to open my detail screen. But within that callback there doesn't seem to be a way to determine what kind of user event triggered it.
So, how do I keep this "two finger swipe to select" behavior without it getting messed up by trackpad clicks?
I tried adding my own gesture recognizer to help me detect swipes. But when I check it from within my shouldBeginMultipleSelectionInteractionAt
callback I only ever see it in the possible
state, even if I make sure to put it at the beginning of the gestureRecongizers
array.
I also tried actually checking the collectionView.gestureRecognizers
array for one-finger gestures that have triggered, but this did not work very consistently.
Upvotes: 0
Views: 26