| Home | Software | AppleScripts | Cocoa | Music Stuff |

CocoaAccessorWriter

CocoaAccessorWriter automates the writing of accessor methods when developing software using the Cocoa object library and the Objective-C language on Mac OS X.

CocoaAccessorWriter is a pale imitation of the real thing – Accessorizer – by Kevin Callahan. If you want an extensive array of options and automated help with writing accessors for professional level software using Cocoa on Mac OS X, go and get Accessorizer. It's very good. The last time I looked, it cost $US23. There, now that's out of the way, I can tell you about this pale imitation.

CocoaAccessorWriter writes basic accessor method declarations and implementations for you after you enter your variable declaration into the first text field of it's window. Here's a screenshot:

Download CocoaAccessorWriter application.

That's pretty much all there is to it. There's no help or buttons, nor is there much in the way of extras. There is a preference to use your Xcode editor's font – the default – otherwise it will use the system default font for text fields. It doesn't really matter because whatever font you use in Xcode will be the one you see when you paste the results from CocoaAccessorWriter into your project's source files. There are two refinements: firstly, if the instance variable you enter is a primitive type (ie, short, unsigned, signed, long, int, float, double) then the resulting set<VarName>: method will just make a simple assignment, rather than the retain/release required for an object; and secondly, if the name of your variable starts with a vowel, the name of the argument in the setter method is prefixed with "an" instead of "a". Seeing aArray is very irritating.

If you are actually interested in this, you can download the source and improve it to your heart's content. Let me know if you do or if you have any comments/suggestions. My email address is in the source code.