<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSpeechRecognizerDelegate/speechRecognizer(_:didRecognizeCommand:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSSpeechRecognizerDelegate(im)speechRecognizer:didRecognizeCommand:"
  },
  "title" : "speechRecognizer(_:didRecognizeCommand:)"
}
-->

# speechRecognizer(_:didRecognizeCommand:)

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

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

## Discussion

`command` is one of the strings from the array passed to [`commands`](/documentation/AppKit/NSSpeechRecognizer/commands). The delegate typically evaluates which command was recognized and performs the related action.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)