In Xcode 4, if you option + click on a keyword, then the said keyword will appear in a popover with a bunch of descriptive information, like so:
However, when I option + click on my own method or variable, all I get is a link to the file in which the object was declared:
How is this done? Can I take advantage of this for my own code?
(I've noticed in some of the framework headers, that there is some sort of special comment syntax. Could that be related?)
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:
You must create your own "documentation set" for your API. Search Xcode's documentation for "Documentation Set Guide" and dig in. The "Documentation Sets" section of the guide specifically states that Quick Help uses this.
With a doc set in place, not only will this popup find the description but it will be available in the QuickHelp in the Utility pane as well as the documentation browser in the Organizer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With