How to create documentation for instance variable and methods in Xcode?
Asked Answered
S

2

7

I'd like to be able to Alt-Click an instance variable (or a method) as part of the program i created and read what it's purpose is.

The fact that Xcode is telling me the class variable is declared at - is nice but not enough. In this case i'd like to see custom text i typed to describe what an asset really is. Additionally type of the ivar would also be useful to know.

How can this be done? In this case, i wonder what exactly did i mean by assets

I specifically wonder if this information can be viewed from inside Xcode, similar to how Eclipse shows JavaDoc content.

enter image description here

Senecal answered 26/11, 2011 at 1:26 Comment(0)
T
5

You would need to create a documentation set for your project and install it in Xcode. appledoc can help you with this. This is a command-line tool that can generate documentation in Apple's style from specially formatted comments in your headers. You can also integrate this into your build process with a run script build phase, so that documentation is always up-to-date.

For small projects, it's usually not worth the effort though and you're probably better off just adding comments to your header files and jumping there with Cmd-click (Ctrl+Cmd+left-arrow to go back to where you came from).

Teraterai answered 26/11, 2011 at 2:40 Comment(1)
This is very cool! This does not help access information from within the Xcode, does it?Senecal
F
3

You'll probably want to take a look at Apple's documentation on Documentation Sets as well as their article on generating doc sets using Doxygen. The latter is based on Xcode 3.x, so how relevant it is is somewhat questionable, but it'd be a good idea to take a look nonetheless.

That said, if you decide to use Doxygen (alternatives like HeaderDoc can be used for documentation, but I'm not sure what's available to you as far as creating doc sets goes), it looks like the main point is you'll want to throw GENERATE_DOCSET=YES into your Doxyfile (or whatever you decide to call it). After that, you'd just throw the results into ~/Library/Developer/Shared/Documentation/DocSets (according to Doxygen's documentation). I don't know whether this works in Xcode 4.x - it's worth a shot though, and it'd be nice to hear back on it.

Note: most of this was based on this answer by Barry Wark. Figure credit is due there, since I wouldn't have bothered looking into this were it not for his answer.

Flotage answered 26/11, 2011 at 2:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.