Objective-C method description (doc comments)
comments, documentation, objective-c, xcode
Solution
Update: The format below works for `Objc`. If you want to document swift code, refer to NSHipster's blog about Swift Documentation
The Xcode 5 can do what you want. Thanks to Wonil Kim, in the .h file:
/**
* Add new message between source to destination timeline as empty name string
* @author Wonil Kim
*
* @param sourceId Source timeline entity ID
* @param destId Destination timeline entity ID
* @return A newly created message instance
*/
- (ISMessage*)messageFromTimeline:(NSInteger)sourceId toTimeline:(NSInteger)destId;
Once this is done, you can alt+click on the method name, and.. voilà!
Of course, as you can see on Kim's blog, this is not the only way:
/*! Some description of the method....
* \returns The result
*/
Alternatively,
/// Some description to show up, done by:
/// @author Olly Dixon
You got the point...
As many already have mentioned, Objective-C does not show you your documentation; in fact, neither does java (javadoc, may be). It's your IDE, in this case, the un-crashable Xcode :)
UPDATE2: Complete list of "Special Commands" in comments.
UPDATE3: Use VVDocumenter-Xcode if you'd like to enable auto-generation of documentation by `///`.
UPDATE4:: VVDocumenter has be integrated in to Xcode:
Use the shortcut (⌥ Option + ⌘ Command + /) to add a documentation comment to your code if you are using Xcode 8 or above
Problem
I'm currently learning Objective-C and need to know how to write a method description. I'm having a lot of difficulty learning how to do this in Objective-C. In Jave we have this ``` /** < h2 >MethodName</ h2 > < p >Various Description, can use html with images etc.</ p > */ private void methodName(args[]..) { } ``` In objective-c where do I place the description? Also does this to be in the header file or the implementation file? ``` //Within Implementation? - (float)gteHeightPercentage:(float)percentageToGet { return self.view.bounds.size.height * percentageToGet; } //Within Header? - (float)getWidthPercentage:(float)percentageToGet; ```