Chapter 12: Managing Data and Memory in Cocoa


In This Chapter

Introducing data collection objects

Using NSCoder and NSData

Archiving and de-archiving object properties

Managing memory

Cocoa includes unique data collection objects, which are used almost as regularly as floats, ints, and character strings are in C and Java. You can use these objects as custom object stores, but you'll also spend time packing data into a collection and passing it to a Cocoa class, and unpacking data from a collection returned by a Cocoa class.

mac_caution.eps Caution

Cocoa doesn't always use data collections efficiently. Certain classes force you to pack data into an array or dictionary when you want to pass a single string or a number. This adds overhead and complicates the code, but it is sometimes obligatory.

Basic data collection skills include:

bl.eps Understanding the difference between mutable and standard classes.

Understanding the difference between arrays, sets, dictionaries, and byte data.

Finding objects ...

Get Cocoa® now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.