<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSDraggingItem",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDraggingItem"
  },
  "title" : "NSDraggingItem"
}
-->

# NSDraggingItem

A single dragged item within a dragging session.

```
class NSDraggingItem
```

## Overview

[`NSDraggingItem`](/documentation/AppKit/NSDraggingItem) objects have extremely limited lifetimes. Don’t retain these items because changing outside of the prescribed lifetimes has no impact on the drag.

When you call the [`NSDraggingSession`](/documentation/AppKit/NSDraggingSession) method [`beginDraggingSession(with:event:source:)`](/documentation/AppKit/NSView/beginDraggingSession(with:event:source:)), the system immediately consumes the dragging items that pass to the method, and doesn’t retain them. Any further changes to the dragging item associated with the returned [`NSDraggingSession`](/documentation/AppKit/NSDraggingSession) must occur with the enumeration method [`enumerateDraggingItems(options:for:classes:searchOptions:using:)`](/documentation/AppKit/NSDraggingSession/enumerateDraggingItems(options:for:classes:searchOptions:using:)). When enumerating, the system creates `NSDraggingItem` instances right before giving them to the enumeration block. After returning from the block, the dragging item is no longer valid.

## Topics

### Initializing a dragging item

[`-  initWithPasteboardWriter:`](/documentation/AppKit/NSDraggingItem/init(pasteboardWriter:))

Creates and returns a dragging item using the specified content.

### Dragging frame

[`-  setDraggingFrame:contents:`](/documentation/AppKit/NSDraggingItem/setDraggingFrame(_:contents:))

Sets the item’s dragging frame and contents.

[`draggingFrame`](/documentation/AppKit/NSDraggingItem/draggingFrame)

The frame of the dragging item.

### Drag image components

[`imageComponents`](/documentation/AppKit/NSDraggingItem/imageComponents)

An array of dragging image components to use to create the drag image.

[`imageComponentsProvider`](/documentation/AppKit/NSDraggingItem/imageComponentsProvider)

An array of blocks that provide the dragging image components.

[`ImageComponentKey`](/documentation/AppKit/NSDraggingItem/ImageComponentKey)

Keys that identify components of a dragging image.

[`item`](/documentation/AppKit/NSDraggingItem/item)

The pasteboard reader or writer object dependent on the context where you use the dragging item.

## Relationships

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)