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.
@optional
methods also available to implement automatically (shortcut: control + I).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With