Isaac Wasserman
Isaac Wasserman

Reputation: 1541

AVSpeechUtterance completion handler

How do I set a completion event on the SpeakUtterance(utterance) function in Swift? I need this so that my speech is neither interrupted nor interrupting.

Upvotes: 1

Views: 723

Answers (1)

rickster
rickster

Reputation: 126137

Have you looked at the header (or generated Swift interface) for AVSpeechSynthesizer? Or its documentation? Looks pretty straightforward there...

  1. Set an instance of one of your classes as the delegate of the speech synthesizer.

  2. In that class, implement the speechSynthesizer(_:didFinishSpeechUtterance:) method. It'll be called whenever an utterance finishes speaking.

  3. There's no step three.

Upvotes: 6

Related Questions