Possible Duplicate:
Difference between Category and Class Extension?
I am often told that when you want to declare a variable as private you would make a nameless category on the .m file.
Is there anything inherently different in the nameless category as opposed to named categories?
What’s the difference?
What you refer to as a ‘nameless category’ is called a ‘class extension’.
One difference is that the compiler expects that declarations in the class extension are defined in the class’
@implementationblock. That is, you do not declare the extension’s@implementationblock explicitly when it is in the same translation as the primary@implementationblock. They are merged for your convenience. Consequently, the compiler may produce warnings.Another difference is that an extension may declare properties which are synthesized (and consequently resize the type), where a regular category cannot. In addition to properties, instance variables may be declared in the class extension’s
@interface.Beyond that, it’s just convention.