AVSpeechUtterance completion handler

717 Views Asked by At

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.

1

There are 1 best solutions below

0
On

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.