---
title: "collectionView(_:canDragItemsAt:with:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionviewdelegate/collectionview(_:candragitemsat:with:)-49wix"
---

# collectionView(_:canDragItemsAt:with:)

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

## Declaration

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

## Parameters

- `collectionView`: The collection view making the request.
- `indexPaths`: The index paths of the items about to be dragged.
- `event`: The mouse-down event that began the drag operation.

## Return Value

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

## Discussion

Discussion 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

- [Supporting Collection View Drag and Drop Through File Promises](appkit/supporting-collection-view-drag-and-drop-through-file-promises.md)
- [collectionView(_:pasteboardWriterForItemAt:)](appkit/nscollectionviewdelegate/collectionview(_:pasteboardwriterforitemat:)-5eyyl.md)
- [collectionView(_:writeItemsAt:to:)](appkit/nscollectionviewdelegate/collectionview(_:writeitemsat:to:)-23ozm.md)
- [collectionView(_:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAt:)](appkit/nscollectionviewdelegate/collectionview(_:namesofpromisedfilesdroppedatdestination:fordraggeditemsat:)-6yag4.md)
- [collectionView(_:draggingImageForItemsAt:with:offset:)](appkit/nscollectionviewdelegate/collectionview(_:draggingimageforitemsat:with:offset:)-898js.md)
- [collectionView(_:draggingSession:willBeginAt:forItemsAt:)](appkit/nscollectionviewdelegate/collectionview(_:draggingsession:willbeginat:foritemsat:)-68x2y.md)
- [collectionView(_:draggingSession:endedAt:dragOperation:)](appkit/nscollectionviewdelegate/collectionview(_:draggingsession:endedat:dragoperation:).md)
- [collectionView(_:updateDraggingItemsForDrag:)](appkit/nscollectionviewdelegate/collectionview(_:updatedraggingitemsfordrag:).md)
- [collectionView(_:validateDrop:proposedIndexPath:dropOperation:)](appkit/nscollectionviewdelegate/collectionview(_:validatedrop:proposedindexpath:dropoperation:).md)
- [collectionView(_:acceptDrop:indexPath:dropOperation:)](appkit/nscollectionviewdelegate/collectionview(_:acceptdrop:indexpath:dropoperation:).md)
