Instance Method


Notifies the delegate object that one or more items were selected.


optional func collectionView(_ collectionView: NSCollectionView, didSelectItemsAt indexPaths: Set<IndexPath>)



The collection view notifying you of the selection change.


The set of NSIndexPath objects corresponding to the items that are now selected.


After the user successfully selects one or more items, the collection view calls this method to let you know that the selection has been made. Use this method to respond to the selection change and to make any necessary adjustments to your content or the collection view.

This method is not called when you set the selection programmatically using the methods of the NSCollectionView class.

See Also

Managing the Selection

func collectionView(NSCollectionView, shouldDeselectItemsAt: Set<IndexPath>) -> Set<IndexPath>

Asks the delegate object to approve the pending deselection of items.

func collectionView(NSCollectionView, didDeselectItemsAt: Set<IndexPath>)

Notifies the delegate object that one or more items were deselected.