Speech Synthesizer doesn't execute function to turn on or off flag to turn on Speech Recognizer.

extension Quiz {
    func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didStart utterance: AVSpeechUtterance) {
        print("AVSpeechSynthesizerDelegate: didStart")
        doneSpeaking = false
    }
    
    func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didFinish utterance: AVSpeechUtterance) {
        print("AVSpeechSynthesizerDelegate: didFinish")
        doneSpeaking = true
        
    }


These extensions are not working to change the flag named doneSpeaking once the speech Synthesizer turns on or off. What should I do?