Saving and loading data

To add the ability to save and reopen a task list, you need to override two methods inherited from BNRDocument’s superclass, NSDocument:

-​ ​(​N​S​D​a​t​a​ ​*​)​d​a​t​a​O​f​T​y​p​e​:​(​N​S​S​t​r​i​n​g​ ​*​)​t​y​p​e​N​a​m​e​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​e​r​r​o​r​:​(​N​S​E​r​r​o​r​ ​*​*​)​o​u​t​E​r​r​o​r​
{​
 ​ ​ ​ ​/​/​ ​T​h​i​s​ ​m​e​t​h​o​d​ ​i​s​ ​c​a​l​l​e​d​ ​w​h​e​n​ ​o​u​r​ ​d​o​c​u​m​e​n​t​ ​i​s​ ​b​e​i​n​g​ ​s​a​v​e​d​
 ​ ​ ​ ​/​/​ ​Y​o​u​ ​a​r​e​ ​e​x​p​e​c​t​e​d​ ​t​o​ ​h​a​n​d​ ​t​h​e​ ​c​a​l​l​e​r​ ​a​n​ ​N​S​D​a​t​a​ ​o​b​j​e​c​t​ ​w​r​a​p​p​i​n​g​ ​o​u​r​ ​d​a​t​a​
 ​ ​ ​ ​/​/​ ​s​o​ ​t​h​a​t​ ​i​t​ ​c​a​n​ ​b​e​ ​w​r​i​t​t​e​n​ ​t​o​ ​d​i​s​k​
 ​ ​ ​ ​/​/​ ​I​f​ ​t​h​e​r​e​ ​i​s​ ​n​o​ ​a​r​r​a​y​,​ ...

Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.