Do I need to include @synthesize?
Asked Answered
S

3

6

I created a @property by right-clicking and dragging from ViewController.xib into ViewController.h, but @synthesize is not being automatically created in ViewController.m.

This post said that @synthesize is no longer necessary, but I'm wondering if auto-complete needs @synthesize for it to work correctly.

Q: Do I need to include @synthesize?

Setscrew answered 22/10, 2012 at 16:58 Comment(0)
H
10

In a word, no. Xcode 4.5 is fully aware of the fact that @synthesize is no longer required. You're good to go without!

Hiphuggers answered 22/10, 2012 at 17:1 Comment(1)
@Phillip If my answer was sufficient for your needs, could you please accept it? ThanksHiphuggers
A
1

When using ARC @synthesize auto appears. outside ARC you have to add it. Adrian

Annual answered 22/10, 2012 at 17:8 Comment(3)
It's a compiler addition, it's unrelated to ARC. You don't need to specify @synthesize in retain/release code either in Xcode 4.5Hiphuggers
You do if your code is supposed to work with GCC or the LLVM+GCC frontend, or if it may be compiled with an older SDK.Ponton
Note, though, that Apple has officially deprecated the use of gcc.Hagiolatry
A
1

Yes, you are good to go but make sure you specify it like this: self.textInput.text=@"Hello world" Without the self it is not recognized.

Alaska answered 28/11, 2013 at 15:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.