Contents

collectionView(_:performAction:forItemAt:withSender:)

Tells the delegate to perform the specified action on an item in the collection view.

Declaration

optional func collectionView(_ collectionView: UICollectionView, performAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?)

Parameters

  • collectionView:

    The collection view object that is making the request.

  • action:

    The selector representing the action to be performed.

  • indexPath:

    The index path of the affected item.

  • sender:

    The object that initiated the action.

Discussion

If the user taps an action in the editing menu, the collection view calls this method. Your implementation of this method should do whatever is appropriate for the action. For example, for a copy action, it should extract the relevant item content and write it to the general pasteboard or an application (private) pasteboard.

For information about how to perform pasteboard-related operations, see UIPasteboard.

See Also

Deprecated