April 2015
Intermediate to advanced
556 pages
17h 47m
English
When your application is first launched, your PreferenceManager object will need to register the factory defaults. Add a method which registers the defaults in PreferenceManager.swift:
class PreferenceManager {
private let userDefaults = NSUserDefaults.standardUserDefaults()
func registerDefaultPreferences() {
let defaults =
[ activeVoiceKey : NSSpeechSynthesizer.defaultVoice() ,
activeTextKey : "Able was I ere I saw Elba." ]
userDefaults.registerDefaults(defaults)
}
}
If you try to run the app at this point,
you will get a compiler error:
Use of unresolved identifier 'NSSpeechSynthesizer'.
This means that the compiler does not know what
NSSpeechSynthesizer is. This is because NSSpeechSynthesizer ...
Read now
Unlock full access