EsbenB EsbenB - 2 months ago 18
Objective-C Question

automatically insert header doc comments in Objective C?

Since XCode 5 now supports reading header comments directly from header files, it has become increasingly interesting, to document functionality in a consistent way.

I therefore try to find a tool that can automatically insert header doc comments in Objective C header files, but can't seem to find one?

Basically I would like a took that could write something like:

/*!
<desc method.>
@param parmA
<desc of parmA>
@param parmB
<desc of parmB>
@result
<desc of result>
*/
- (CO2 *)doSomething:(typeName)parmA withSomething:(typeName)parmB;

Answer

I found this very handy Xcode plugin to write all the default comment code for you.

https://github.com/onevcat/VVDocumenter-Xcode

EDIT

As of Xcode 8, there is a new shortcut available that has the same behaviour as the VVDocumenter plugin.

Place the cursor above any function, class, struct,... and hit ⌘ + ⌥ + /

This will generate a comment accordingly to where you placed the cursor.