Contents

collectionView(_:didSelectItemAt:)

Tells the delegate that the item at the specified index path was selected.

Declaration

optional func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)

Parameters

  • collectionView:

    The collection view object that is notifying you of the selection change.

  • indexPath:

    The index path of the cell that was selected.

Discussion

The collection view calls this method when the user successfully selects an item in the collection view. It does not call this method when you programmatically set the selection.

See Also

Managing the selected cells