Like Avi mentioned, there is @synthesize
keyword. If you just declare property(without implementing getter and setter for it) the corresponding ivar will be generated. Its name will be [underscore][property_name].For example declaring @property currentNumber;
leads to implicit applying `@synthesize currentNumber = _currentNumber;
But if you want to assign ivar with another name to your property you can declare this ivar and synthesize the property with it:
@interface AppDelegate ()
{
NSNumber *_anotherIvar;
}
@property (strong, readwrite, nonatomic) NSNumber *currentNumber;
@end
@implementation AppDelegate
@synthesize currentNumber = _anotherIvar;
@end
@synthesize tells the compiler to create corresponding getter and setter which are backed by ivar on the right side of assignment. And if you provide your own setter - you prevent compiler from creating implicit synthesize(and generating ivar), so you need to provide ivar by yourself somehow(for example use explicit synthesize).
Here is good explanation about @synthesize.