0

I have created my iPhone App and i must do a document like javaDoc in java but i don't find anything with google. I think that the comments have similar syntax but i'm not sure. (/* */)

Can you help me? Thanks

zp26
  • 1,507
  • 8
  • 20
  • 38
  • duplicate: see the following for alternative using HeaderDoc http://stackoverflow.com/questions/813529/documentation-generator-for-objective-c – falconcreek Jul 20 '10 at 19:02

3 Answers3

3

As Peter said above, there is DOxygen and then also DOxyClean which cleans it up a bit. More info here: http://developer.apple.com/tools/creatingdocsetswithdoxygen.html

Comments can either be like this

// this is a comment above some line of code
if (foo != 0) { 
    // do something 
}

or like this

/*
// look ma, i'm commenting out a bunch of code

if (foo != 0) {
   // do something here
}

*/

or like this

// TODO: i'm marking something that will show up as a To-Do item in XCode's drop down list

and i think there's another one but I can't remember off hand

iwasrobbed
  • 46,496
  • 21
  • 150
  • 195
  • 1
    As an example of this, Core Plot uses Doxygen to generate its framework documentation: http://code.google.com/p/core-plot/wiki/DocumentationPolicy – Brad Larson Jul 20 '10 at 17:54
1

You can use // for single line comments, or /** */ for multi-line comments.

You'd also be wise to make use of #pragma mark to further organize your code. See here: http://cocoasamurai.blogspot.com/2006/09/tip-pragma-mark-organizing-your-source.html

There are also tools like Doxygen: hhttp://www.doxygen.nl

albert
  • 8,285
  • 3
  • 19
  • 32
pkananen
  • 1,325
  • 1
  • 11
  • 23
  • and the last question, i must add the comments for the .h or for the .h and .m ??? – zp26 Jul 20 '10 at 14:36
  • You can add them however you want. I would recommend looking at some of Apple's example code to see how they document things. A header file is supposed to provide a contract for the class, so much of your documentation will go there. – pkananen Jul 20 '10 at 14:41
0

The answer about Doxygen was right on back when it was written, but since then Appledoc has come a long way. It can now generate documentation that actually integrates with the popup dialogs that looks very close to the official documentation.

I would highly advise folks to use Appledoc going forward instead of Doxygen.

http://gentlebytes.com/appledoc/

PS - Doxygen is still a great product, and can be used for other things. It's just not the best for iOS projects anymore.

DougW
  • 28,776
  • 18
  • 79
  • 107