Xcode: Possible to auto-create stubs for methods required by Protocol interface?

Coming from an Eclipse / Java background, one of my favorite features is the ability to quickly stub out all the methods required by an interface. In Eclipse, I can choose 'Override / implement' from the source menu to generate stub methods for any method of the Interface.

I'd like to do the same thing in Objective-C. For instance, if I declare a class that implements the 'NSCoding' protocol, I'd like to have Xcode automatically generate the methods required to implement this Protocol. It's frustrating to have to look-up and then copy/paste the signatures of the required methods every Protocol that I'm trying to implement.

I've been trying for awhile to find out if this is possible, but haven't found anything promising yet. Is this possible in XCode?


I believe that Accessorizer will do what you want.


Accessorizer will write the encode and decode methods for ivars passed to it (NSCoding protocol and for NSDocument archiving). It will also generate string constants either static or #define with a custom prefix; copyWithZone:; and other things if you need - all from a simple shortcut via Services or from the toolbar. Accessorizer keyed archiving


Not the direсt answer, just hint:

Out of the box XCode can't.

But AppCode can.

It can do this things automatically (with your permission, of course).

If some methods of protocol marked as @required - AppCode will highlight the implementation and suggest to implement this methods.

example

@optional methods also available to implement automatically (shortcut: control + I).


Your can create scripts for the scripting menu item in AppleScript, Perl, Python, Ruby, or any other scripting language that go in the scripting menu.

Your could place the insertion point in the .m file and have the script look up the corresponding .h file. Locate the protocols supported and so forth...

MacTech ran an article in 2007 Xcode Menu Scripts