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

# NSDraggingSession

An object that encapsulates a drag-and-drop action.

```
class NSDraggingSession
```

## Overview

You start a new dragging session by calling [`beginDraggingSession(with:event:source:)`](/documentation/AppKit/NSView/beginDraggingSession(with:event:source:)) or [`beginDraggingSession(items:gesture:source:)`](/documentation/AppKit/NSView/beginDraggingSession(items:gesture:source:)) on an `NSView`. The method immediately returns, and the actual drag begins at the next turn of the run loop.

## Topics

### Dragging Pasteboard

[`draggingPasteboard`](/documentation/AppKit/NSDraggingSession/draggingPasteboard)

Returns the pasteboard object that contains the data being dragged.

### Dragging Visual Representation

[`animatesToStartingPositionsOnCancelOrFail`](/documentation/AppKit/NSDraggingSession/animatesToStartingPositionsOnCancelOrFail)

Controls whether the dragging image animates back to its starting point on a cancelled or failed drag.

[`draggingFormation`](/documentation/AppKit/NSDraggingSession/draggingFormation)

Controls the dragging formation when the drag is not over the source or a valid destination.

### Identifying the Dragging Session

[`draggingSequenceNumber`](/documentation/AppKit/NSDraggingSession/draggingSequenceNumber)

Returns a number that uniquely identifies the dragging session.

### Enumerating Dragging Items

[`-  enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock:`](/documentation/AppKit/NSDraggingSession/enumerateDraggingItems(options:for:classes:searchOptions:using:))

Enumerates through each dragging item.

### Dragging Session Location

[`draggingLocation`](/documentation/AppKit/NSDraggingSession/draggingLocation)

The current cursor location of the drag in screen coordinates.

### Dragging Item Location

[`draggingLeaderIndex`](/documentation/AppKit/NSDraggingSession/draggingLeaderIndex)

The index of the dragging item under the cursor.

## Relationships

### Conforms To

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

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

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

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

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

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

### 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)