Search code examples
objective-ctemplatesios8xcode6class-extensions

xCode6 iOS8 how to create a file with an extension for an existing class?


if I remember correctly, in xCode 5 and below, the "New File" option for project navigator included a template to create an extension for an existing class. This option was next to "Cocoa Touch Class" and allowed to enter a base class name. The generated file had a form like "NSString+JSON.h"

How do I create class extensions in xCode 6? Do I start with a class file and then modify it and it's name to include category name?

enter image description here


Solution

  • The process is similar to this question I answered:

    How to create Objective-C Protocol in new version of XCode Version 6.0.1 (6A317) for iOS

    Select New File > Objective-C File > Choose Extension from the dropdown. enter image description here