29

From the Xcode 4.4 release notes:

The compiler automatically calls @synthesize by default for unimplemented @properties

What exactly does the new default synthesizer look like? Does it create a variable of the same name as the property (or does it prefix it with an underscore, which seems to be a good practice, but required extra typing so far)?

Simon
  • 25,468
  • 44
  • 152
  • 266
Thilo
  • 257,207
  • 101
  • 511
  • 656

1 Answers1

55

the default is @synthesize propertyName = _propertyName

wattson12
  • 11,176
  • 2
  • 32
  • 34
  • 6
    -1 for Apple. How do I override this behaviour? Why can't this horrible underscore convention go away and die? – Sam Jul 26 '12 at 13:23
  • 10
    @Sam you can always write your own synthesize, same as you did before 4.4. Whats wrong with this convention though? – wattson12 Jul 26 '12 at 13:35
  • 5
    Yes, but there doesn't seem to be any way to change the automatically generated `@synthesize`. Which is inconsistent with the behaviour of `@synthesize propertyName;`. Don't get me started on underscores, or this will degenerate into a religious war. – Sam Jul 26 '12 at 13:52
  • 2
    more reading on the subject: http://useyourloaf.com/blog/2012/08/01/property-synthesis-with-xcode-4-dot-4.html – brainray Sep 27 '12 at 16:41
  • @PawanSharma you can still use synthesize if you like, but why would you want to disable this? – wattson12 Oct 30 '12 at 10:49