O'Reilly logo

Cocoa® by Richard Wentk

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

mac_ch12.eps
co_bar.eps

Chapter 12: Managing Data and Memory in Cocoa

mac_chbox12.eps

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 ...

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