Skip to content

Instantly share code, notes, and snippets.

@MrRooni
Created April 9, 2012 20:30
Show Gist options
  • Save MrRooni/2346405 to your computer and use it in GitHub Desktop.
Save MrRooni/2346405 to your computer and use it in GitHub Desktop.
// Update: The plot thickens! In a Mac project you get the behavior outlined below where dragged and dropped
// IBOutlet property creation yields (assign)'ed properties. In an iOS project however, dragged and dropped
// IBOutlets get created thusly:
@property (retain, nonatomic) IBOutlet UIButton *someButton;
// -- Original post begins here:
// Since the inception of properties I've written IBOulet properties like so:
@property (nonatomic, retain) IBOutlet NSButton *someButton;
// Today I dragged and dropped from interface builder to my header file in Xcode 4 to create an outlet and got this:
@property (assign) IBOutlet NSButton *someButton;
// Given that atomic properties get extra thread-safety in their generated accessors it has always made
// more sense to me to have nonatomic accessors and save on the overhead. As such I was surprised to see
// that atomic IBOutlets are the Xcode default. The question I have is: why is atomic the Xcode default
// for IBOutlets?
@jfro
Copy link

jfro commented Apr 9, 2012

Well regarding the iOS/Mac bit, I believe non-property IBOutlets in iOS are retained vs not on the mac, so the properties are matching to that. Though I'd love to hear about why one is atomic and one is not.

@kdbdallas
Copy link

Have you heard anything about this from anyone (perhaps someone inside of Apple)?

@MrRooni
Copy link
Author

MrRooni commented Jun 4, 2012

The rumor is that it's just different styles between the App Kit and UI Kit teams and how they decided Xcode should handle these things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment