A task object that you use to monitor the speech recognition progress.


class SFSpeechRecognitionTask : NSObject


Use an SFSpeechRecognitionTask object to determine the state of a speech recognition task, to cancel an ongoing task, or to signal the end of the task.

You do not create speech recognition task objects directly. Instead, you receive one of these objects after calling recognitionTask(with:resultHandler:) or recognitionTask(with:delegate:) on your SFSpeechRecognizer object.


Canceling a Speech Recognition Task

func cancel()

Cancels the current speech recognition task.

var isCancelled: Bool

A Boolean value that indicates whether the speech recognition task was canceled.

Finishing a Speech Recognition Task

func finish()

Stops accepting new audio and finishes processing on the audio input that has already been accepted.

var isFinishing: Bool

A Boolean value that indicates whether audio input has stopped.

Monitoring Recognition Progress

var state: SFSpeechRecognitionTaskState

The current state of the speech recognition task.

enum SFSpeechRecognitionTaskState

The state of the task associated with the recognition request.

var error: Error?

An error object that specifies the error that occurred during a speech recognition task.


Inherits From

Conforms To