new

I’ve been a Cocoa developer for ten years. (Less than some, but more than most.) And whenever I see new in someone’s code, I assume they’re new to Objective-C, that they’ve just gotten here from Java or C++.

But now, because of ARC, I’ve started using new as a replacement for alloc/init, just because it’s more compact.

In other words, I’ll type [NSCache new] instead of [[NSCache alloc] init].

Total surprise to me.

23 May 2012

Archive