collectionView(_:canDragItemsAt:with:)
Returns a Boolean indicating whether a drag operation involving the specified items can begin.
Declaration
@MainActor optional func collectionView(_ collectionView: NSCollectionView, canDragItemsAt indexPaths: Set<IndexPath>, with event: NSEvent) -> BoolParameters
- 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
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 PromisescollectionView(_:pasteboardWriterForItemAt:)collectionView(_:writeItemsAt:to:)collectionView(_:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAt:)collectionView(_:draggingImageForItemsAt:with:offset:)collectionView(_:draggingSession:willBeginAt:forItemsAt:)collectionView(_:draggingSession:endedAt:dragOperation:)collectionView(_:updateDraggingItemsForDrag:)collectionView(_:validateDrop:proposedIndexPath:dropOperation:)collectionView(_:acceptDrop:indexPath:dropOperation:)