So after updating to Xcode 12.0.1 AVSpeechSynthesizer is now working on simulator (it hasn't been working for me for a while). Now, the isSpeaking variable is always false regardless of whether the synthesizer is speaking. I would like to trigger a change in my view as a function of whether the synthesizer is speaking. Simple version below, any ideas?
import SwiftUI
import AVFoundation
struct ContentView: View {
var synthesizer = AVSpeechSynthesizer()
var utterance = AVSpeechUtterance(string: "Hello World")
var body: some View {
VStack {
Text(synthesizer.isSpeaking ? "Speaking" : "Not Speaking")
Button(action: {synthesizer.speak(utterance)}) {
Text("Speak To Me")
}
}
}
}