---
title: "performCommand(for:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextensioncontext/performcommand(for:)-25rd1"
---

# performCommand(for:)

Performs the command associated with the given key command.

## Declaration

```swift
func performCommand(for keyCommand: UIKeyCommand) -> Bool
```

## Parameters

- `keyCommand`: The key command received by the first responder.

## Return Value

Return Value Returns YES if a command corresponding to the UIKeyCommand was found and performed, NO otherwise.

## Discussion

Discussion This method checks for a command corresponding to the provided UIKeyCommand and performs it, if available. The app should use this method to perform any extension commands at an appropriate time in the app’s responder object that handles the performCommand(for:) action.
