func speak(AVSpeechUtterance ) func continueSpeaking () -> Bool func pauseSpeaking (at: AVSpeechBoundary ) -> Bool func stopSpeaking (at: AVSpeechBoundary ) -> Bool enum AVSpeechBoundary class AVSpeechSynthesizerTo speak some text, create an AVSpeech instance that contains the text and pass it to speak(_:) on a speech synthesizer instance. You can optionally also retrieve an AVSpeech and set it on the utterance’s voice property to have the speech synthesizer use that voice when speaking the utterance’s text.
The speech synthesizer maintains a queue of utterances that it speaks. If the synthesizer isn’t speaking, calling speak(_:) begins speaking that utterance either immediately or after pausing for its pre, if necessary. If the synthesizer is speaking, the synthesizer adds utterances to a queue and speaks them in the order it receives them.
After speech begins, you can use the synthesizer object to pause or stop speech. After pausing, you can resume the speech from its paused point or stop the speech entirely and remove all remaining utterances in the queue.
You can monitor the speech synthesizer by examining its is and is properties, or by setting a delegate that conforms to AVSpeech. The delegate receives significant events as they occur during speech synthesis.
An AVSpeech also controls the route where the speech plays. For more information, see Directing speech output.
Note
The system doesn’t automatically retain the speech synthesizer, so you need to manually retain it until speech concludes.
func speak(AVSpeechUtterance ) func continueSpeaking () -> Bool func pauseSpeaking (at: AVSpeechBoundary ) -> Bool func stopSpeaking (at: AVSpeechBoundary ) -> Bool enum AVSpeechBoundary var isSpeaking : Bool var isPaused : Bool var delegate: (any AVSpeechSynthesizerDelegate )? protocol AVSpeechSynthesizerDelegate var usesApplicationAudioSession : Bool var mixToTelephonyUplink : Bool var outputChannels : [AVAudioSessionChannelDescription ]? func write(AVSpeechUtterance , toBufferCallback : AVSpeechSynthesizer .BufferCallback ) typealias BufferCallback func write(AVSpeechUtterance , toBufferCallback : AVSpeechSynthesizer .BufferCallback , toMarkerCallback : AVSpeechSynthesizer .MarkerCallback ) typealias MarkerCallback class var personalVoiceAuthorizationStatus : AVSpeechSynthesizer .PersonalVoiceAuthorizationStatus class let availableVoicesDidChangeNotification : NSNotification.Name class func requestPersonalVoiceAuthorization (completionHandler : (AVSpeechSynthesizer .PersonalVoiceAuthorizationStatus ) -> Void) enum PersonalVoiceAuthorizationStatus