Make custom types appear in Xcode's documentation popup - objective-c

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.

Related

HOWTO Export/Import custom code snippets in XCode 6

Is there a way how to export the custom code snippets from XCode 6 and then import it to the XCode 6 of another user?
The snippets are now in one XML file: /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/SystemCodeSnippets.codesnippets
Thanks
In Xcode 7.3.1, my snippets have been created in ~/Library/Developer/Xcode/UserData/CodeSnippets. It looks like you may be in the wrong directory. Put your codes snippets in this directory instead.
On a side note, you can find my code snippets here: XcodeSnippets GitHub

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.

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/ )

Preferences toolbar without BWToolkit

Since Xcode 4, using BWToolkit isn't really easy. In fact, it's not even possible in IB.
Is there some sample code out there how to create a "preferences-type toolbar" without BWToolkit?
Yes, MVPreferencesController as used by Camino. See here for Doxygen documentation. It displays NSPreferencePanes registered using a plist. It's pretty easy to work with and customize for your purposes. You can also use the Camino project as a source of sample prefpanes.

How comments similar to <summary></summary> from C# should be used in 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