<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/PasteButton/init(supportedContentTypes:payloadAction:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11PasteButtonV21supportedContentTypes13payloadActionACSay22UniformTypeIdentifiers6UTTypeVG_ySaySo14NSItemProviderCGctcfc"
  },
  "title" : "init(supportedContentTypes:payloadAction:)"
}
-->

# init(supportedContentTypes:payloadAction:)

Creates a Paste button that accepts specific types of data from the
pasteboard.

```
nonisolated init(supportedContentTypes: [UTType], payloadAction: @escaping ([NSItemProvider]) -> Void)
```

## Parameters

`supportedContentTypes`

The exact uniform type identifiers supported
by the button. If the pasteboard doesn’t contain any of the
supported types, the button becomes disabled.

`payloadAction`

The handler to call when the user clicks the Paste
button and the pasteboard has items that conform to
`supportedContentTypes`. This closure receives an array of
item providers that you use to inspect and load the pasteboard data.

## Discussion

Set the contents of `supportedContentTypes` in order of your app’s
preference for its supported types. The Paste button takes the
most-preferred type that the pasteboard source supports and delivers
this to the `payloadAction` closure.

---

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)