Class Extensions
A special case allows creating a category without a name; that is, no name is specified between the ( and ). This special syntax defines what is known as a class extension. When you define an unnamed category like this, you can extend the class by adding additional instance variables and properties. This is not allowed for named categories. Methods declared in a class extension are implemented in the main implementation section for the class and not in a separate implementation section.
Class extensions are useful, because their methods are private. So, if you need to write a class that has data and methods that can be used only within the class itself, a class extension might just fit the bill.
Note
The methods are private ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access