Exercises

  1. Use @dynamic, +resolveInstanceMethod, and the class_addMethod() function to add a property implementation method at runtime. Manipulating the Objective-C runtime is not covered here, but you can find out about this in Apple’s Objective-C 2.0 Runtime Reference.

  2. Measure the performance of atomic and nonatomic properties in garbage collected and non-garbage collected environments. Are there real performance differences?

  3. The requirement that collections not mutate while you are iterating over them can be inconvenient at times, especially if you are doing a scan the collection and pull out stuff that shouldn’t be there operation. What would it take to make a classic array enumerator support having the collection mutated during iteration? ...

Get Advanced Mac OS X 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.