1

i know if we use @synthesize compiler create the getters and setters on base of our property define in the hadder file..but if we want to create our own getters and setter what will we do ? how we create our own getters and stters for this

@synthesize navcontroller

@property (nonatomic, retain) UINavigationController *navcontroller;

if we create our own getters and setters that perform faster or @synthesize getter and setters preform faster and why ?...

Nik's
  • 690
  • 1
  • 10
  • 27
  • Mostly you won't notice a huge difference. After all the you're doing the same thing, just manually instead of automatically. – futureelite7 Aug 06 '11 at 13:05
  • Refer to [this question](http://stackoverflow.com/questions/4141189/objective-c-custom-getter-setter). Regardless of how they are created, the performance gain or loss will be trivial at best. Spend your time optimizing in other areas. – FreeAsInBeer Aug 06 '11 at 12:59
  • This [example](http://useyourloaf.com/blog/2011/2/8/understanding-your-objective-c-self.html) may describe you well, performance of getter and setter depends on the standard of the code of writing – Praveen-K Aug 06 '11 at 12:59

1 Answers1

1

i will give you one small example of this

create one setter and getter like this...

-(XYPoint *) origin
{
    return origin;
}

- (void) setOrigin: (XYPoint *) pt
{
    origin = pt;
}

and if you create this by make synthesize. these both perform the same work. this is no such a big d/f in performance so don't worry about the perfomance.