---
title: "setDraggingFrame(_:contents:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdraggingitem/setdraggingframe(_:contents:)"
---

# setDraggingFrame(_:contents:)

Sets the item’s dragging frame and contents.

## Declaration

```swift
func setDraggingFrame(_ frame: NSRect, contents: Any?)
```

## Parameters

- `frame`: The item content frame, which is in the same coordinate space as the value of doc://com.apple.appkit/documentation/AppKit/NSDraggingItem/draggingFrame.
- `contents`: The item contents to display when dragging. Typically this is an NSImage, but a CGImageRef will also work.

## Discussion

Discussion Alternate single image component setter. This convenience method simplifies modifying the components of an NSDraggingItem when there is only one component. It sets the draggingFrame and creates a single NSDraggingImageComponent instance with one image corresponding to the icon key. You should use this method only under the following conditions: the drag image for this item is composed of a single image, or there are a reasonable number of dragging item instances being created or enumerated. If your application requires the dragging of hundreds of items this method would create a instance for each item when it is called. Compare this to the imageComponentsProvider block which is much faster to define and allows AppKit to create only a subset of the items using imageComponentsProvider. This method sets the draggingFrame and imageComponents properties.

## See Also

### Related Documentation

- [imageComponentsProvider](appkit/nsdraggingitem/imagecomponentsprovider.md)

### Dragging frame

- [draggingFrame](appkit/nsdraggingitem/draggingframe.md)
