Instance Method


Invoked when the mouse is released over a collection view that previously allowed a drop.


optional func collectionView(_ collectionView: NSCollectionView, acceptDrop draggingInfo: NSDraggingInfo, index: Int, dropOperation: NSCollectionView.DropOperation) -> Bool



The collection view that send the message.


An object that contains more information about this dragging operation.


The index of the proposed drop item.


The type of dragging operation.

Return Value

true if the drop operation should be accepted, otherwise false.


This method is called when the mouse is released over a collection view that previously decided to allow a drop via the collectionView(_:validateDrop:proposedIndex:dropOperation:) method. At this time, the delegate should incorporate the data from the dragging pasteboard and update the collection view's contents.

You must implement this method for your collection view to be a drag destination

See Also

Legacy Collection View Support

func collectionView(NSCollectionView, canDragItemsAt: IndexSet, with: NSEvent) -> Bool

Returns a Boolean indicating whether the collection view can begin dragging the specified items.

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

Provides the pasteboard writer for the item at the specified index

func collectionView(NSCollectionView, writeItemsAt: IndexSet, to: NSPasteboard) -> Bool

Invoked after it has been determined that a drag should begin, but before the drag has been started.

func collectionView(NSCollectionView, namesOfPromisedFilesDroppedAtDestination: URL, forDraggedItemsAt: IndexSet) -> [String]

Invoked to return an array of filenames that the receiver promises to create.