Adding Properties to a Category Using Associated Objects

Categories are a cool feature of Objective-C that allow you to extend existing classes with extra methods. This helps you to write really clean code by adding utility methods directly to the classes they relate to, so they can be called in a natural, object-oriented way.

A typical example of a category method is given below. Here we add an isNumeric method to NSString:

Continue reading