Add Documentation to Xcode Project
Our last steps resulted in a set of HTML pages that provide some documentation of our project. The HTML was saved in a folder in our project directory. To make the documentation easy to access, let's add it to our Xcode project.
Right-click (or Ctrl-click) on the PathDemo group in the left pane of your Xcode project and choose Add -> New Group.
Rename your new group
Right-click (or Ctrl-click) on the Documentation group and select Add -> Existing Files.
PathDemoproject folder, find the
htmlfolder. In that folder, select the file
Now there is a convenient link to your documentation that you directly access from within your project. However, it might show the HTML code rather than the rendered web page when you click on the file. We can change this behavior in the Xcode preferences.
Choose Preferences from the Xcode menu.
Switch to the File Types tab, and find the text.html settings under the file/text group. Choose
HTML Fileas the preferred editor and click on OK.
You may need to close and reopen your project to get the documentation to render as HTML. When you do, spend some time exploring what is there.
What we have at this point is documentation that lists every method and variable from our classes. We have not created any special descriptions; so far everything has been automatic. We even added the documentation to your project so that you do not have to launch a web browser to read the documentation.
Making It Automatic
Right now it isn't too hard to update the documentation if our code changes. We can simply press Start in the Doxygen user interface. However, it would be nice if we could skip this step. We can do that by adding a step to our build process. That way, the documentation will be updated every time we build the project in Xcode. This is possible because Doxygen can run from the command line as well as from the GUI.
Expand the Target group in the left pane of Xcode.
Right-click on the PathDemo target and choose Add -> New Build Phase -> New Shell Script Build Phase.
Type the following into the Script text field:
This is a very simple script! All you are doing is calling the Doxygen program with the
Doxyfileconfiguration as input. When you use the Doxygen user interface to change the configuration and save the changes to this file, the changes will be seen the next time you build the project.
Close the Shell Script Info pane when you are done with it.