<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionViewDelegate/collectionView(_:draggingImageForItemsAt:with:offset:)-4yvk5",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSCollectionViewDelegate(im)collectionView:draggingImageForItemsAtIndexes:withEvent:offset:"
  },
  "title" : "collectionView(_:draggingImageForItemsAt:with:offset:)"
}
-->

# collectionView(_:draggingImageForItemsAt:with:offset:)

Creates and returns a drag image to represent the specified items during a drag.

```
@MainActor optional func collectionView(_ collectionView: NSCollectionView, draggingImageForItemsAt indexes: IndexSet, with event: NSEvent, offset dragImageOffset: NSPointPointer) -> NSImage
```

## Parameters

`collectionView`

The collection view making the request.

`indexes`

The indexes of the items being dragged.

`event`

The mouse-down event that initiated the drag.

`dragImageOffset`

An in/out parameter that is initially set to <doc://com.apple.documentation/documentation/Foundation/NSZeroPoint>, which causes the image to be centered under the mouse. The value can be modified to reposition the returned image.

## Return Value

The image to use for the dragged items.

## Discussion

If the delegate does not implement this method, the collection view uses the image returned by [`draggingImageForItems(at:with:offset:)`](/documentation/AppKit/NSCollectionView/draggingImageForItems(at:with:offset:)-951w7).

You do not need to implement this method for your collection view to be a drag source.

---

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)