init(supportedContentTypes : [UTType], payloadAction : ([NSItemProvider ]) -> Void)
The exact uniform type identifiers supported by the button. If the pasteboard doesn’t contain any of the supported types, the button becomes disabled.
Availability 有効性
Technology
init<Payload>(supportedContentTypes: [UTType
], validator: @escaping ([NSItemProvider
]) -> Payload?, payloadAction: @escaping (Payload) -> Void
)
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.
validator
A handler that receives those contents of the pasteboard that conform to supported
. Load and inspect these items to determine whether to validate the button. If you load a valid item, return it from this closure. If the pasteboard doesn’t contain any valid items, return nil
to invalidate the button.
payloadAction
The handler called when the user clicks the button. This closure receives the preprocessed result of validator
.
Set the contents of supported
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 validator
closure.
init(supportedContentTypes : [UTType], payloadAction : ([NSItemProvider ]) -> Void)