In the notes on changes caused by Swift 2.0, the change for pg.123 says:
let attributes = NSSpeechSynthesizer.attributesForVoice(voice)
return attributes[NSVoiceName] as? String
But the parameter passed to the voiceNameForIdentifier(_ function in the book is ‘identifier’. So shouldn’t it be:
func voiceNameForIdentifier(identifier: String) -> String? {
let attributes = NSSpeechSynthesizer.attributesForVoice(identifier)
return attributes[NSVoiceName] as? String
}