Here’s a (reduced) class declaration from an example on apple’s developer:
@interface myController : UITableViewController {
NSArray *samples;
}
@property (nonatomic, retain) NSArray *samples
What is the purpose of declaring
{
NSArray *samples;
}
when you declare it again as a property? If you leave out:
{
NSArray *samples;
}
you can still use @synthesize in your .m and get a reference to it!
I’m a little confused as to the purpose of the first declaration.
Thanks
Properties are just a handy way to declare accessors to you data. It usually leads to some member variable but not necessarily. And that member var can have different name:
Or you can use properties without vars at all:
With new compiler you can use properties without ivars at all, compiler will generate them for you implicitly.