---
title: "onCopyCommand(perform:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/oncopycommand(perform:)"
---

# onCopyCommand(perform:)

Adds an action to perform in response to the system’s Copy command.

## Declaration

```swift
nonisolated func onCopyCommand(perform payloadAction: (() -> [NSItemProvider])?) -> some View

```

## Parameters

- `payloadAction`: An action closure returning the doc://com.apple.documentation/documentation/Foundation/NSItemProvider items that should be copied to the Clipboard when the Copy command is triggered. If action is nil, the Copy command is considered disabled.

## Return Value

Return Value A view that triggers action when a system Copy command occurs.

## See Also

### Copying items using item providers

- [onCutCommand(perform:)](swiftui/view/oncutcommand(perform:).md)
- [onPasteCommand(of:perform:)](swiftui/view/onpastecommand(of:perform:).md)
- [onPasteCommand(of:validator:perform:)](swiftui/view/onpastecommand(of:validator:perform:).md)
