O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Register Factory Defaults for the Preferences

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:

c​l​a​s​s​ ​P​r​e​f​e​r​e​n​c​e​M​a​n​a​g​e​r​ ​{​

 ​ ​ ​ ​p​r​i​v​a​t​e​ ​l​e​t​ ​u​s​e​r​D​e​f​a​u​l​t​s​ ​=​ ​N​S​U​s​e​r​D​e​f​a​u​l​t​s​.​s​t​a​n​d​a​r​d​U​s​e​r​D​e​f​a​u​l​t​s​(​)​

 ​ ​ ​ ​f​u​n​c​ ​r​e​g​i​s​t​e​r​D​e​f​a​u​l​t​P​r​e​f​e​r​e​n​c​e​s​(​)​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​l​e​t​ ​d​e​f​a​u​l​t​s​ ​=​
 ​ ​ ​ ​ ​ ​ ​ ​[​ ​a​c​t​i​v​e​V​o​i​c​e​K​e​y​ ​:​ ​N​S​S​p​e​e​c​h​S​y​n​t​h​e​s​i​z​e​r​.​d​e​f​a​u​l​t​V​o​i​c​e​(​)​ ​,​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​a​c​t​i​v​e​T​e​x​t​K​e​y​ ​ ​:​ ​"​A​b​l​e​ ​w​a​s​ ​I​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required