<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIPasteboard/data(forPasteboardType:inItemSet:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIPasteboard(im)dataForPasteboardType:inItemSet:"
  },
  "title" : "data(forPasteboardType:inItemSet:)"
}
-->

# data(forPasteboardType:inItemSet:)

Returns the data objects in the indicated pasteboard items that have the given representation type.

```
func data(forPasteboardType pasteboardType: String, inItemSet itemSet: IndexSet?) -> [Data]?
```

## Parameters

`pasteboardType`

A string identifying a representation type. Typically this is a UTI.

`itemSet`

An index set with each integer value identifying a pasteboard item positionally in the pasteboard. Pass in `nil` to request all pasteboard items.

## Return Value

An array of <doc://com.apple.documentation/documentation/Foundation/NSData> objects or, if a requested pasteboard item has no data of the the type indicated by `pasteboardType`, a <doc://com.apple.documentation/documentation/Foundation/NSNull> 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)