Search code examples
objective-cxcodedocumentation-generationappledoc

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


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


Solution

  • 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).