-2

I have a property like window
I saw in some example use:

@synthesize window = _window

is this statement still necessary for xcode5 and above?

Tulon
  • 4,011
  • 6
  • 36
  • 56
Adam Lee
  • 24,710
  • 51
  • 156
  • 236
  • No, that is deprecated. @property takes care of everything you need. – niksawtschuk May 23 '14 at 22:04
  • This should answer your question:http://stackoverflow.com/questions/14658142/ios6-purpose-of-synthesize. In short, not needed, it's auto synthesized since Xcode 4. – dagnytaggart May 23 '14 at 22:04
  • 3
    @niksawtschuk It's not deprecated. – nhgrif May 23 '14 at 22:05
  • FYI - The version of Xcode is irrelevant. Whether you need `@synthesize` or not is a function of the compiler, not the IDE. – rmaddy May 23 '14 at 22:49
  • @nhgrif my apologies, that was the first word to come to mind and it wasn't exactly what I meant to say. Leaving my comment as a lesson for future readers. – niksawtschuk May 23 '14 at 23:04

1 Answers1

4

No.

@synthesize is no longer necessary for properties.

Properties are auto-synthesized to their name prefixed with an underscore as of Xcode 4.

HOWEVER, @synthesize is NOT deprecated. If you don't like the underscore convention, you can manually synthesize your properties to whatever you want.

Additionally, properties declared in @protocols are NOT auto-synthesized, but can still be synthesized using the @synthesize keyword.

nhgrif
  • 61,578
  • 25
  • 134
  • 173