---
title: "speechRecognizer(_:didRecognizeCommand:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsspeechrecognizerdelegate/speechrecognizer(_:didrecognizecommand:)"
---

# speechRecognizer(_:didRecognizeCommand:)

Invoked when the recognition engine has recognized the application command command.

## Declaration

```swift
@MainActor optional func speechRecognizer(_ sender: NSSpeechRecognizer, didRecognizeCommand command: String)
```

## Discussion

Discussion command is one of the strings from the array passed to commands. The delegate typically evaluates which command was recognized and performs the related action.

## See Also

### Related Documentation

- [Speech Programming Topics](apple-archive/documentation/Cocoa/Conceptual/Speech.md)
