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

# init(pasteboardWriter:)

Creates and returns a dragging item using the specified content.

```
init(pasteboardWriter: any NSPasteboardWriting)
```

## Parameters

`pasteboardWriter`

The object that provides the dragging content. The object must implement the [`NSPasteboardWriting`](/documentation/AppKit/NSPasteboardWriting) protocol.

## Return Value

An initialized NSDraggingItem instance with the specified dragging content.

## Discussion

When the developer creates an `NSDraggingItem` instance , it is for use with the view method [`beginDraggingSession(with:event:source:)`](/documentation/AppKit/NSView/beginDraggingSession(with:event:source:)) During the invocation of that method, the `pasteboardWriter` is placed onto the dragging pasteboard for the `NSDraggingSession` that contains the dragging item instance.

The designated initializer.

---

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)