Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Javadoc-like plugin for Xcode that automatically generates the doc template?

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 {...
like image 859
Mark Avatar asked Mar 19 '10 09:03

Mark


3 Answers

The script here http://www.duckrowing.com/2011/05/14/using-the-doxygen-helper-in-xcode-4/ does exactly what you want.

EDIT: Here is an updated version of the Script: https://github.com/premosystems/DoxygenXCodeHelper

like image 51
Tom Avatar answered Sep 28 '22 09:09

Tom


I have been using VVDocumenter-Xcode successfully in Xcode 5 and it works well. It automatically generates a template specific to a method when you enter "///" above the method.

like image 29
Groundstop Avatar answered Sep 28 '22 11:09

Groundstop


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.

like image 21
uliwitness Avatar answered Sep 28 '22 09:09

uliwitness