Instance Method


Returns a Boolean indicating whether a drag operation involving the specified items can begin.


optional func collectionView(_ collectionView: NSCollectionView, canDragItemsAt indexPaths: Set<IndexPath>, with event: NSEvent) -> Bool



The collection view making the request.


The index paths of the items about to be dragged.


The mouse-down event that began the drag operation.

Return Value

true if the drag operation can begin or false if it cannot.


If you do not implement this method and your collection view has only one section, the collection view calls the legacy collectionView(_:canDragItemsAt:with:) method. If you do not implement either method, the collection view assumes a return value of true.

See Also

Drag and Drop Support

func collectionView(NSCollectionView, pasteboardWriterForItemAt: IndexPath) -> NSPasteboardWriting?

Provides the pasteboard writer for the item at the specified index path.

func collectionView(NSCollectionView, writeItemsAt: Set<IndexPath>, to: NSPasteboard) -> Bool

Places the data for the drag operation on the pasteboard.

func collectionView(NSCollectionView, namesOfPromisedFilesDroppedAtDestination: URL, forDraggedItemsAt: Set<IndexPath>) -> [String]

Returns the names of the promised files that you created for a drag operation.

func collectionView(NSCollectionView, updateDraggingItemsForDrag: NSDraggingInfo)

Asks your delegate to update the dragging items during a drag operation.