Using Appledocs to generate documentation

David West picture David West · Mar 4, 2013 · Viewed 7.2k times · Source

I apologize for the simplicity of my question, but I was trying to generate documentation using Appledocs (https://github.com/tomaz/appledoc#quick-install)

I'm not sure how exactly to get it setup. The way I do it is:

  • I clone the github repo and then install appledocs using the install script (I confirm this using appledocs --help) in the terminal.

However, now how do I actually use this in the sense that I have my project in xcode:

  • how do I generate the documentation file
  • where is it generated?

Answer

Robin van Dijke picture Robin van Dijke · Mar 4, 2013

What I always do is add a new target to my project which can generate documentation. You can go to your project build phases and click on 'Add Target'. Choose Aggregate under Other and give it some name (e.g. ProjectDocumentation).

Still on the build phases tab go to 'Add build phase' and click 'Add run script'. You can now paste the following and adjust it to your own settings:

/usr/local/bin/appledoc \
--project-name HereProjectName \
--project-company "HereProjectCompany" \
--company-id com.companyName \
--keep-undocumented-objects \
--keep-undocumented-members \
--search-undocumented-doc \
--exit-threshold 2 \
--ignore .m \
--output "AppleDoc" .

I use the ignore *.m because I only only write documentation in my header files. Documentation in my *.m files is for myself only (and thus private). When you build this target, the documentation is generated as a XCode docset. This is accessible by alt-click on a class name. Check out the AppleDoc website for commenting syntax.

For explanation of the command-line options checkout the appledoc --help command.