The iOS 26 sample below speaks well on iPhone/iPad devices and the iOS simulator.
But it does not speak on "Mac (Designed for iPad)", with a voice downloaded via the macOS settings.
Instead it issues this warning :
Invalid maui voice identifier com.apple.voice.enhanced.en-US.Samantha
How to make an iOS app speak on "Mac (Designed for iPad)", with a downloaded voice ?
Note :
- I use iOS 26.5.2 and macOS 26.5.2.
- I use voices that can be found in System Settings > Accessibility > Read & Speak > System voice.
- I have checked that "Samantha (Enhanced)" is the "System voice" in the macOS settings.
- I have checked that the same issue occurs with other voices and other languages.
- There is no such issue for a voice that never needs to be downloaded.
import AVFAudio
import SwiftUI
@main
struct SampleApp: App {
var body: some Scene {
WindowGroup {
SampleView()
}
}
}
struct SampleView: View {
private var synthesizer = AVSpeechSynthesizer()
var body: some View {
Button("Speak", action: speak)
}
private func speak() {
let utterance = AVSpeechUtterance(string: "I speak English.")
utterance.voice = AVSpeechSynthesisVoice(language: "en")
self.synthesizer.speak(utterance)
}
}