Using HeaderDoc to make complete documentation as Html file. By Naveed Khalid
// // File Name.ext // Project Name // // Created by on dd/mm/yyyy. // Copyright 2014 (c). All rights reserved. // File Header Comment
HeaderDoc is a tool that you can run from the command-line. Basically it scans your files for comments made in a particular style. Following that particular style will help in documentation on the go! Which particular style? HeaderDoc Comment
Three styles of comments that HeaderDoc scans for: Option 1: /// Your documentation comment will go here Option 2: /** * Your documentation comment will go here */ Option 3: /*! * Your documentation comment will go here */ HeaderDoc Comment
Three styles of comments that HeaderDoc scans for: Option 1: /// Your documentation comment will go here Option 2: /** * Your documentation comment will go here */ Option 3: /*! * Your documentation comment will go here */ HeaderDoc Comment These are similar to “normal” comments, except that there’s an extra / in option 1, and an extra character in the first line of options 2 and 3 (* and !, respectively).
For single line comments, use the triple forward slash syntax (///) For multiline comments, use the style used in Apple’s documentation (/*!) Best Way?
A tag starts with symbol and a keyword, followed by a space, and a string that contains a description relative to that keyword (such foo). Top-Level Tags: These are tags that declare the type of thing you are commenting (Headers, classes, methods, etc). An example of a top-level tag Second-Level Tags: These tags help to give more detail about the specific thing you are commenting. etc. HeaderDoc Tags?
Some Second-level short string that briefly describes anything. This should not contain multiple Provided for better Doxygen block of text that describes a function, class, header, or data type in name and description of a parameter to a the return values expected from this function. Don't include if the return value is
Example tag in Objective-C Base List of protocol name those this class conforms This is a discussion. It can span many lines or paragraphs. myClass : Classes, Protocols, and Interfaces
Example tag in Objective-C This is a discussion. It can span many lines or paragraphs. Classes, Protocols, and Interfaces
Example tag in Objective-C This is a discussion. It can span many lines or paragraphs. Classes, Protocols, and Interfaces
/*! A really simple way to calculate the sum of two numbers. firstNumber An NSInteger to be used in the summation of two numbers secondNumber The second half of the equation. The sum of the two numbers passed in. */ Documenting Methods
To inform about add tag. Add the following text just above tag: Please make note that this method is only good for adding non-negative numbers. Warnings
Example tag Property The ViewController class' car object. */ Documenting Property
Example tag Tells whether this device is the root power TRUE if this device is the root power domain. For more information on power domains.... */ bool we_are_root; Documenting Variables
Example tag Predefined CFArrayCallBacks structure containing a set of callbacks Extended discussion goes here. */ const CFArrayCallBacks kCFTypeArrayCallBacks; Documenting Constants
Example tag Enumeration Detail description of enum */ Documenting Enumeration
/*! OldCarType A list of older car types. OldCarTypeModelT A cool old car. OldCarTypeModelA A sophisticated old car. */ typedef enum { OldCarTypeModelT, OldCarTypeModelA } OldCarType; Documenting Enumeration
typedef enum { /// A cool, old car. OldCarTypeModelT, /// A sophisticated older car. OldCarTypeModelA } OldCarType; Documenting Enumeration
/*! The car will drive, and then execute the drive block completion A driveCompletion block [car driveCarWithCompletion:^(CGFloat distance){ driven %f", distance); }]; */ Adding Formatted Code
// FIXME: This is broken // !!!: Holy cow, it should be checked! // ???: Perhaps check if the block is not nil first? Other Comments
/*! */ Code Snippet for comments
Open terminal cd /path/to/your/folder headerdoc2html -o ~/Desktop/destinationFolder sourceFolder/ Now to create a Master TOC cd ~/Desktop/documentation gatherheaderdoc. Finalizing: Creating Html