iOS 6 Automatic Property Synthesizer Tutorial Xcode 4.5 Example

2014-04-15 43

http://www.mybringback.com
Jake's G+ = http://goo.gl/Of4a0
Travis's G+ = http://goo.gl/xGz4q

iOS 6 Automatic Property Synthesizer Tutorial Xcode 4.5 Example

In the newest update of Xcode 4.5 Apple includes Apple LLVM compiler 4.0, which adds quite a few new Objective C features. One of the key features that most have ran into, is the default synthesis of properties. In this tutorial we briefly go over the new defaults that the compiler adds for us.

header file (.h)
@property (weak, nonatomic) IBOutlet UILabel *label;

implementation (.m)
@synthesize label = _label;

Previously, the compiler would synthesize and it would appear in the implementation file (.m). Now the compiler no longer needs the @synthesize directive within the implementation file because it will be provided by default.

The default naming convention for instance variables always has an underscore. See example below.

Setting the property of the label:
_label.text = @"hello";


If you want to learn more, check out http://www.mybringback.com

Hit us up on G+, facebook, or twitter!

http://www.facebook.com/mybringback
http://www.twitter.com/mybringback
http://www.todaysawesomesauce.com
-------------

Thanks to Nolan for the Intro Music!