<!--
{
  "availability" : [
    "macOS: 10.11.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionViewDelegate/collectionView(_:acceptDrop:indexPath:dropOperation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSCollectionViewDelegate(im)collectionView:acceptDrop:indexPath:dropOperation:"
  },
  "title" : "collectionView(_:acceptDrop:indexPath:dropOperation:)"
}
-->

# collectionView(_:acceptDrop:indexPath:dropOperation:)

Incorporates the dropped content into the collection view.

```
@MainActor optional func collectionView(_ collectionView: NSCollectionView, acceptDrop draggingInfo: any NSDraggingInfo, indexPath: IndexPath, dropOperation: NSCollectionView.DropOperation) -> Bool
```

## Parameters

`collectionView`

The collection view receiving the dropped content.

`draggingInfo`

The information about the drag operation.

`indexPath`

The index path at which the drop occurred. Use this location as the insertion point for the content.

`dropOperation`

The type of drop operation to perform.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the drop operation should be accepted or <doc://com.apple.documentation/documentation/Swift/false> if it should be rejected.

## Discussion

The collection view calls this method when the user releases the mouse button while it is over a valid drop target. This method is called after the [`collectionView(_:validateDrop:proposedIndexPath:dropOperation:)`](/documentation/AppKit/NSCollectionViewDelegate/collectionView(_:validateDrop:proposedIndexPath:dropOperation:)) method validates that dropping the content at the specified location is possible. You must implement this method to accept the dropped content and incorporate it into the collection view.

In your implementation, use the information in the `draggingInfo` parameter to retrieve the data, update your data source object, and insert the appropriate items into the collection view. The dropped data is stored in the [`draggingPasteboard`](/documentation/AppKit/NSDraggingInfo/draggingPasteboard) property of the dragging information object.

If the [`animatesToDestination`](/documentation/AppKit/NSDraggingInfo/animatesToDestination) property of the dragging information is <doc://com.apple.documentation/documentation/Swift/true>, update the image and frame for each dragged item to its new location in the collection view.  You can enumerate the list of dragged items using the [`enumerateDraggingItems(options:for:classes:searchOptions:using:)`](/documentation/AppKit/NSDraggingInfo/enumerateDraggingItems(options:for:classes:searchOptions:using:)) method of the dragging information object.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)