views:

265

answers:

3

I'm aware of Doxygen to generate the documentation. What I'm looking for is quick way to insert documentation in Xcode similar to what Eclipse does when editing Java files.

Let's say I have an objective-c method with a couple of arguments like this:

-(NSInteger*) sumOf: (NSInteger*) one and:(NSInteger*) two {...

In Eclipse, if you place the cursor above the method and type: /**<Enter> you get a Javadoc template pre-populated with @param and @return tags.

Is it possible to achieve something similar in Xcode? After typing /**<Enter>, I'd like to get this automatically:

/**
 *
 * @param one
 * @param two
 * 
 * @return
 */
 -(NSInteger*) sumOf: (NSInteger*) one and:(NSInteger*) two {...
A: 

If you've got the patience, take a look here as it explains completion behavior and overrides in XCode. I don't know if this will work for the comment set but it seems like a good start.

-- Frank

Frank C.
+1  A: 

Apple has their own version of a Doxygen like system, which I recall is this one. http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/HeaderDoc/usage/usage.html

It is simply an executable, so you would have to add a post-build setting in your project settings if you wanted it to run automatically. Hence, if you go through the trouble, you could also just use Doxygen.

PLG
A: 

The "User Scripts" menu (that little black scroll icon in Xcode's menu bar) has a HeaderDoc submenu with templates for all sorts of documentation markup in HD syntax. You can set a keyboard shortcut for the items you want to use by going to "Key Bindings" in Xcode's "Preferences" window.

Since User Scripts are essentially shell scripts, you can use any scripting language to write your own, so if you wanted you could even write a little regex-aided script that parses the parameter names out of the selected line and fills out the basics of your HeaderDoc comment.

uliwitness