AVSpeechSynthesizer delegate not being called

I have this code:

class SpeechSynthesizerDelegate: NSObject, AVSpeechSynthesizerDelegate {
     func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didFinish utterance: AVSpeechUtterance) {
         print("Speech finished.")         
     }

     func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didCancel utterance: AVSpeechUtterance) {
         print("Speech canceled.")
     }

     func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didStart utterance: AVSpeechUtterance) {
         print("Speech started.")
     }

     func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didPause utterance: AVSpeechUtterance) {
         print("Speech paused.")
...

that I try to use like this

 let synthesizer = AVSpeechSynthesizer()
        let delegate = SpeechSynthesizerDelegate()
        synthesizer.delegate = delegate

but when I call

synthesizer.speak(utterance)

the delegate methods are not being called. I am running this on Mac OS ventura. How can I fix this?

AVSpeechSynthesizer delegate not being called
 
 
Q