Reputation: 50468
I've seen all kinds of variations in style for the placement of @synthesize statements. I'm wondering - is there a majority consensus for this, or, failing that, a statement from a centralized style guide (ie, apple's guide) about where to place them?
Please provide references.
Upvotes: 0
Views: 153
Reputation: 42598
In Apple's examples, they place the @synthesize statements at the top of the implementation. This seems to be the way lots of people do it. I think mostly because that's how Apple does it.
I prefer having them at the bottom of the implementation. I try to order my code in such a way that the most significant code is near the top. Frankly, properties should not be all that interesting. If you have anything that's not boilerplate in your properties, then you're most likely doing it wrong.
My order is usually public methods, view lifecycle, delegate callbacks, private methods, memory management, then synthesized properties (with accessors).
Upvotes: 1
Reputation: 815
Usually just below @implementation ClassName
line
So that you can see them easily and add new ones easily
Upvotes: 1
Reputation: 12215
Yes, of course it's in the @implementation... But I don't think it is the question.
I wondered same questions, as
There is absolutely no diffenrence, and I'm not sure if there is kind of convention about, but here is mine ;) :
properties grouped by meaning (for example, one line of UI, on line of data structures, etc...)
@implementation MyClass
@synthesize label1, label2, button;
@synthesize array, dictionay;
Upvotes: 1
Reputation: 86307
You can use the @synthesize and @dynamic directives in @implementation blocks.
Upvotes: 1