Okay Atomic

I have habitually declared my properties as nonatomic. Exceptions are extremely rare.

Since atomic is the default, I have to do this:

@property (nonatomic, strong) NSString *foo;

But it occurs to me now that switching to atomic will not be a performance issue. It makes sense to stick with nonatomic for things like Core Data objects — but it isn’t really needed for things like IBOutlets and other properties that are not frequently set.

Since it isn’t really needed in those cases, I could just go with the default and save myself a little typing and a little code.

@property (strong) NSString *foo;

Hmmm. Looks naked, but I could get over that.

Update 3:12 pm: I just learned that strong is the default for properties since Xcode 4.3.

Which means I could do this:

@property NSString *foo;

I like less code. It looks shocking to me — scandalous, even — but I’d adapt.

Update July 17, 2012: I just couldn’t do it. I’m sticking with nonatomic — and still declaring explicitly as strong.

08 Jul 2012

Archive