collectionView(_:didBeginMultipleSelectionInteractionAt:)
Tells the delegate when the user starts using a two-finger pan gesture to select multiple items in a collection view.
Declaration
optional func collectionView(_ collectionView: UICollectionView, didBeginMultipleSelectionInteractionAt indexPath: IndexPath)Parameters
- collectionView:
The collection view calling this method.
- indexPath:
The index path of the item that the user touched to start the two-finger pan gesture.
Discussion
Your implementation of this method is a good place to indicate, in the app’s user interface, that the user is selecting multiple items; for example, you could replace an Edit or Select button with a Done button.
func collectionView(_ collectionView: UICollectionView, didBeginMultipleSelectionInteractionAt indexPath: IndexPath) {
// Replace the Select button with Done, and put the
// collection view into editing mode.
setEditing(true, animated: true)
}See Also
Managing the selected cells
Changing the appearance of selected and highlighted cellsSelecting multiple items with a two-finger pan gesturecollectionView(_:shouldSelectItemAt:)collectionView(_:didSelectItemAt:)collectionView(_:shouldDeselectItemAt:)collectionView(_:didDeselectItemAt:)collectionView(_:shouldBeginMultipleSelectionInteractionAt:)collectionViewDidEndMultipleSelectionInteraction(_:)