I am trying do use the isSpeaking property to accomplish this. However, it returns false after the first utterance is spoken and therefore fires of the desired code too early.
According to Apple Dev Documentation isSpeaking:
Returns true if the synthesizer is speaking or has utterances enqueued to speak, even if it is currently paused. Returns false if the synthesizer has finished speaking all utterances in its queue or if it has not yet been given an utterance to speak.
So, I don't really understand why it returns false after one utterance when there is more queued up.
I have also tried using the didFinish utterance method, but it also fires of the code after the first utterance.
Is there a way to know when AVSpeechSynthesizer has finished speaking all queued utterances as in my code example below? I am new to programming so any help accomplishing this would be great. Thanks!
var i = 0
while i < array.count {
let utterance = "Let's talk about \(array[i])."
i += 1
speechSynthesizer.speak(utterance) }