<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPasteboardItem/data(forType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPasteboardItem(im)dataForType:"
  },
  "title" : "data(forType:)"
}
-->

# data(forType:)

Returns the value for the specified type as a data object.

```
func data(forType type: NSPasteboard.PasteboardType) -> Data?
```

## Parameters

`type`

A uniform type identifier string.

## Return Value

The value for the specified type as an `NSData` object.

## Discussion

---

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)