views:

87

answers:

1

I saw an example in The iPhone Developer's Cookbook that extends the UIDevice class using categories.

@interface UIDevice (Reachability)
   // some methods
@end

Typically classes are nouns and methods are verbs. From my point of view categories are similar to subclasses, so I would name the category a noun such as NetworkedUIDevice. How should the name of the category be determined?

+3  A: 

I don't think a strict naming convention is established. Personally, I would go with something like @interface UIDevice (ReachabilityAdditions).

More importantly, you should add a custom prefix to your category methods to avoid namespace conflicts. And this prefix should probably be included in the category name as well.

Ole Begemann