Bradley Golden     About     Archive

Documenting Your Code in Xcode

As a developer I’m always trying to balance my time between coding and commenting. I’d prefer to spend as little amount of time as possible commenting my code while at the time time, maximizing the usefulness of my comments. With that said, I’d like to share VVDocumenter-Xcode with you.

VVDocumenter takes advantage of Xcode’s commenting markup language by generating comment stubs for you by simply typing three forward slashes “///” above a parameter, method, etc.

If you’re not familiar with Xcode’s commenting markup language, please visit this website for Objective-C or this website for Swift. If you’re familiar with Javadocs, Xcode’s markup language for Objective C and Swift is very similar.

Lastly, the final question is, why care about commenting code in a particular way? In Xcode, if you use the option key and hover over a method, you’ll see a question mark appear and the method will highlight blue. If you click a properly commented method, you’ll see something like this:

Pretty right? Now for the icing on the cake…. An open source project called Jazzy is gaining momentum. Jazzy is very similar to Javadocs in the sense that it produces a very pretty html document similar to Apple’s standard documentation.

With the combination of the Apple’s markup language, VVDocumenter and Jazzy, you now have a powerful toolset to comment your code and produce professional documentation with minimal effort!