Learning Foundation

28 Mar
2010

Damn. Didn’t knew about mutableCopy.

NSArray * foo = SomeFunctionReturningAnNSArray();
NSMutableArray * bar = [foo mutableCopy];
[foo release];

What other treasure lie around the Foundation?

NSMutableArray *foo = SomeFunctionReturningAnNSMutableArray();
NSArray * bar = [foo copy];
[foo release];

That’s actually pretty useful! NSArray is both faster and needs less memory than his mutable counterpart.

Related posts:

  1. How-to find strange memory problems with szone_free, szone_malloc_should_clear
  2. Learning Advanced JavaScript
  3. Core Data Notes from iPhone Tech Talk

Comment Form

top

Switch to our mobile site