Search code examples
objective-cobjective-c-category

What do I name the file to create a category for NSString?


My interface, for example, looks like this:

@interface NSString (CategoryName)

And then this for implementation--

@implementation NSString (CategoryName)

But what do I actually call the files? NSString.m/.h ? Does it matter?


Solution

  • It's entirely up to you.

    However, the convention is to name them like this.

    NSString+CategoryName.h

    NSString+CategoryName.m