How comments similar to <summary></summary> from C# should be used in Objective C? - objective-c

Is there any solution in to make comments before each method in Obj C code similar to from from C#? I'd like to provide an information about my custom methods by Alt + Double mouse click when browsing code.

In objective-c doesn't exists a standard way to comment your code.
I can suggest you to use doxygen, doxygen use a syntax similar to JavaDoc and can generate Docset that xcode can load and use for suggestion.
I understand that this isn't trivial like in C# but for a brief introdution about Doxygen syntax, Usefull script and how to generate Xcode docset take a look at:
http://www.duckrowing.com/2010/03/18/documenting-objective-c-with-doxygen-part-i/
http://www.duckrowing.com/2010/03/18/documenting-objective-c-with-doxygen-part-ii

there is none, no Summary , no Regions

Related

Objective-C method description (doc comments)

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;
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
What you are describing are called “documentation comments”, or “doc comments” for short.
Xcode, as of version 4.6.3, does not display your own doc comments in a pop-up window or its quick help inspector. You have to compile your comments into a “docset” to get Xcode to display them. There are tools to do that, but there is no way to get Xcode to reload a docset except by quitting and restarting it, so I don't recommend bothering.
Xcode 5 (which is currently available as a developer preview for paid members of the OS X and iOS developer programs) does display the doc comments for your own code; see “Quick Help” on the Developer Tools Features page. You must write the doc comments in the header file. You may use either doxygen or headerdoc format.
In objective-c where do I place the description?
Objective-C compilers like gcc and llvm don't care how you document your code. There are several different documentation generators such as Doxygen and HeaderDoc that can build documentation from appropriately formatted comments, usually in your header files. Additionally, Xcode makes it easy to jump to the definition of symbols defined in your code, and it's "quick help" inspector can show you definitions, both without any special annotations in your code.

Quick Help for user defined function in ios

How to show Quick Help for the methods which we wrote ...?
Like for inbuilt function when we right click on it & Click Quick Help then we get all info about that method like that I want to do for user defined methods so that any one come to know that method takes which parameter and each parameter for which purpose?
For more explanation, see these two images:
Here is a solution for that. Also check apple documentation. You might have to create document set and install it in Xcode.
Edit: Here is another similar post, How do you populate the Xcode 4 "Option+Click" popover?
There is an open source tool called appledoc which helps with this. You can provide your own documentation in the header files and then run the appledoc script which will (depending on your settings) generate the docsets, install them into Xcode, create a HTML for the documentation as well as rss feeds so that changes to the documentation can be published.

Make custom types appear in Xcode's documentation popup

I want to achieve the similar result for my own code:
What you are referring to is XCode's documentation viewer and Document Sets.
Check out this tutorial on working with Doxygen, a popular docgen that works well with XCode: http://developer.apple.com/library/mac/#featuredarticles/DoxygenXcode/_index.html (not for XCode 4)
If you are using XCode 4, check out these articles:
Using the Doxygen Helper in Xcode 4
Easy Doxygen code snippets for Xcode 4
DOXYGEN SHORTCUTS IN XCODE4
AppleDoc achieves the result you're looking for.

How to add libclang to xcode?

I would love to do some syntax coloring and code completion on any given code. Ideas inspired from Apple video http://devimages.apple.com/llvm/videos/Libclang.mov
Can anyone tell me about a sample project which uses libclang to parse objective-c code?
Have a look at the Étoilé project: http://etoileos.com/news/archive/2010/10/15/1401/
There you'll find SourceCodeKit that integrates clang for syntax highlighting.
(Source: http://svn.gna.org/viewcvs/etoile/trunk/Etoile/Languages/SourceCodeKit/ )

How do I get Doxygen to link to a method of an Objective-C class?

I'm using Doxygen to document my Objective-C code, and so far it's working fine.
However, I've been searching for hours and I have not been able to find any way to link to a method. For example:
#interface Example : NSObject {
}
/** This is an example method I want to link to. */
- (void)methodWithArgument:(NSString*)one andArgument:(NSString*)two;
/** I want a link to methodWithArgument:andArgument: but Doxygen
* doesn't seem to link the two.
*/
- (void)someOtherMethod;
#end
My expectation is for methodWithArgument:andArgument: to become a link to the appropriate method, but in the generated documentation, it is just plain text.
I have tried lots of other forms:
methodWithArgument:andArgument:
-methodWithArgument:andArgument:
::methodWithArgument:andArgument:
Example::methodWithArgument:andArgument:
But none of them seem to work. Is it possible to link Objective-C methods in Doxygen, and if so, how? Also, how do I link to a method of another class? I know how to do this for C, C++ and Java, but for Objective-C the answer eludes me. Could it be that Doxygen simply doesn't support linking methods in Objective-C? This seems like quite a shortcoming...
You said you tried this one, but it works for me in Doxygen 1.7.2:
/** I want a link to Example::methodWithArgument:andArgument: but Doxygen
* doesn't seem to link the two.
*/
This might depend on your configuration file; I was using a default configuration file generated by doxygen -s -g Doxyfile.