0

Is there some alternative way to document your own functions/methods/variables in objective-c? Like XML documentation in C# and java doc in Java.

Monolo
  • 18,205
  • 17
  • 69
  • 103
GeRyCh
  • 1,580
  • 3
  • 13
  • 23
  • Not mentioned in the answers (or linked question): [AppleDoc](http://gentlebytes.com/appledoc/) – Monolo Apr 08 '13 at 13:08

4 Answers4

2

There has been some development since the other answers have been posted.

AppleDoc has evolved and become quite nice. It creates doc pages in the style of Apple's own pages, which is what you are after if I interpret your question correctly.

Documentation of the comments format here.

Monolo
  • 18,205
  • 17
  • 69
  • 103
2

I would recommend you to use Doxygen. It is what we use internally at work and it works really well. The fact that you could then also use the same system for other languages is also an added bonus if you eventually come to need that.

There is a good guide for automating the generation of your Doxygen docs with your builds here: http://www.guidebee.biz/forum/viewthread.php?tid=168

Ashaman
  • 1,065
  • 7
  • 9
1

I'm having a deja vu ;-) Anyway, it looks like Doxygen can handle Objective-C as well; I have not personally tried it though.

Community
  • 1
  • 1
Christian.K
  • 47,778
  • 10
  • 99
  • 143
0

Good news everyone! Xcode 5 now has built-in support for DOxygen style comments. So, you can comment your methods like this:

/*!
 * Provides an NSManagedObjectContext singleton appropriate for use on the main 
 * thread. If the context doesn't already exist it is created and bound to the 
 * persistent store coordinator for the application, otherwise the existing 
 * singleton contextis returned.
 * \param someParameter You can even add parameters
 * \returns The a shared NSManagedObjectContext for the application.
 */
+ (NSManagedObjectContext *)sharedContext;


Inline help will look like this:

inline help



Quick help will look like this:

quick help



And sidebar help will look like this:

sidebar help

Here's a handy code snippet you can add the your Xcode Code Snippet library to make method documentation simple:

/**
 <#description#>
 @param <#parameter#>
 @returns <#retval#>
 @exception <#throws#>
 */

doxygen code snippet

Now, you can just type "doxy" and poof! You have your doxygen template.

memmons
  • 40,222
  • 21
  • 149
  • 183