Reputation: 1541
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
Reputation: 126137
Have you looked at the header (or generated Swift interface) for AVSpeechSynthesizer
? Or its documentation? Looks pretty straightforward there...
Set an instance of one of your classes as the delegate
of the speech synthesizer.
In that class, implement the speechSynthesizer(_:didFinishSpeechUtterance:)
method. It'll be called whenever an utterance finishes speaking.
There's no step three.
Upvotes: 6