How to do the documentation in objective C? [closed]

余生颓废 提交于 2019-12-01 17:34:38
FrustratedWithFormsDesigner

I don't know what IDE you're using but doxygen lets you generate documentation from comments in Objective-C (as well as C, C++, Java, and some others).

If you're using Xcode (just assuming, since you're using Objective-C), there does seem to be some level of integration (not tested by me, just found on Google): http://developer.apple.com/tools/creatingdocsetswithdoxygen.html

Good news for all! :D Finally after waiting a long time Apple has introduced a parser comments for our projects. According to the new features in XCode 5:

Project documentation from framework API reference documentation and structured comments in your own source code are displayed in the quick help panel and in code completion popover views. Doxygen and HeaderDoc structured comments are supported formats.

and from the Clang 3.2 release notes:

Clang parses the comments and can detect syntactic and semantic errors in comments. These warnings are off by default. Pass -Wdocumentation flag to enable warnings about documentation comments.

If you want to see an example of this new feature I recommend you take a look at the following article: Documentation in Xcode 5

The standard way, as @DiegoPalomar suggested, is to use HeaderDoc, Apple's own tool for embedding structured comments in source code.

It comes with Xcode, so no installation required. It comes with a command-line script that generates HTML output of your documentation.

Docs for HeaderDoc:

Here's an example:

/*!
 *  Takes in a number and adds 4 to it.
 *
 *  @param myNumber a number of type NSInteger.
 *
 *  @return The number with 4 added to it.
 */
- (NSInteger)addFour:(NSInteger)myNumber {
    return myNumber + 4;
}

Big plus: when you alt-click on your documented method, your doc appears in the balloon:

HeaderDoc is open-source too: http://www.opensource.apple.com/source/headerdoc/

I think you're looking for Doxygen.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!