Initializer

init(supportedContentTypes:payloadAction:)

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

Declaration 宣言

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.

See Also 参照

Creating a Paste Button ペースト(貼り付け)ボタンを作成する