Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: show documentation for my custom classes

Tags:

xcode

How can I force Xcode to show my own documentation for custom classes, methods, etc.? I'm used to Java and Eclipse, which shows me documentation for my classes as shown here:

Eclipse showing Javadocs documentation

How can I achieve the same in Xcode? Are there special comments that Xcode can recognize and display?

Xcode showing generic documentation for NSObject

like image 706
Peter Štibraný Avatar asked Aug 05 '11 15:08

Peter Štibraný


2 Answers

As of Xcode 5.0, Doxygen and HeaderDoc formatting for variables and methods is automatically parsed and rendered in the Quick Help popover. More information about it here, but here's some key bits:

/**  * Add a data point to the data source.  * (Removes the oldest data point if the data source contains kMaxDataPoints objects.)  *  * @param aDataPoint An instance of ABCDataPoint.  * @return The oldest data point, if any.  */  - (ABCDataPoint *)addDataToDataSource:(ABCDataPoint *)aDataPoint; 

renders in Xcode as:

As for properties, it's as easy as:

/// Base64-encoded data. @property (nonatomic, strong) NSData *data; 

When option-clicked, this lovely popover appears:

like image 174
cbowns Avatar answered Sep 26 '22 00:09

cbowns


Well, it seems that for the classes the question hasn't still been answered, so I'll post my suggestions.

Just before the @interface MyClass : NSObject line in the MyClass.h file you use the comment like you did in your example, but adding some tags to display the text. For example the code below:

/**  * @class GenericCell  * @author Average Joe  * @date 25/11/13  *  * @version 1.0  *  * @discussion This class is used for the generic lists  */ 

will produce the following output: the output of the code above http://imageshack.com/a/img18/2194/kdi0.png

like image 40
Deboroh88 Avatar answered Sep 24 '22 00:09

Deboroh88