---
title: cancel()
framework: speech
role: symbol
role_heading: Instance Method
path: speech/sfspeechrecognitiontask/cancel()
---

# cancel()

Cancels the current speech recognition task.

## Declaration

```swift
func cancel()
```

## Discussion

Discussion You can cancel recognition tasks for both prerecorded and live audio input. For example, you might cancel a task in response to a user action or because the recording was interrupted. When canceling a task, be sure to release any resources associated with the task, such as the audio input resources you are using to capture audio samples.

## See Also

### Canceling a speech recognition task

- [isCancelled](speech/sfspeechrecognitiontask/iscancelled.md)
