Home Page
About Us


An Accessor is (usually) a function that is responsible for reading or writing a property.


In object-oriented programming, an instance variable is a variable defined in a class (i.e



Technically accessing the ivar directly is faster than using accessors but there are very few situations in which it will make a significant performance difference and would probably be a case of premature optimization

from question  

Self.variableName vs. _variableName vs. @sysnthesize variableName

That is one possible reason for the sample code to eschew accessor in favor of direct access but precisely why it is done in any given case is not necessarily easy to know;another possible reason is that accessing the ivar is faster and on ios in particular cycles are hard-won

from question  

Again about self and instance variables in Objective-C

Nonatomic properties don t use locks but direct ivar is faster because it skips the accessor call

from question  

Why would you use an ivar?

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0