When writing code, if you write a note in the header file according to certain specifications,
You can generate a complete HTML project document using Xcode's document auto-output feature.
The resulting format is almost identical to the API documentation on the Apple developer website.
Let's take a look at how to build a project document with Xcode.
Steps:
1. Click Project in Xcode and then click Add Target to add a target to the project.
2. In the Add Target Pop-up dialog box, select Aggregate, click Next, enter a name you like, click Finish
3. You will find a project under targets, click on it, then click on the Buildphases tab on the right, then click Add Build Phase and select Add Run Script
4. After the Run script has been added successfully, click on its drop-down menu to copy the following code into the Code dialog box.
# Shell script goes here
Mkdir-p Headerdoc
Find./hellophonegap/classes-name \*.h-print | Xargs Headerdoc2html-o Headerdoc
Gatherheaderdoc Headerdoc
Exit 0
Note: the./hellophonegap/classes in the code is the saved path to your class file, which you modify according to your own situation.
5. Select the target you just created in the scheme in the upper left corner of Xcode, then click Run.
After running, in your project folder, a document folder will be generated.
These automatically generated documents are generated based on comments that you write in the source code.
Attention
Choose Vvdocumenter
Appear
The following is a detailed description of the various can be automatically generated document comments
Header: Head file basic information. This is used at the very beginning of the header file for each source code file.
For example:
/*!
@header the information here should match the name of the source code file
@abstract Some basic descriptions of this source code file
@author Kevin Wu (author information)
@version 1.00 2012/01/20 Creation (version information for this document)
*/
Class: Type information. This comment is used at the beginning of the class declaration.
For example:
/*!
@class
@abstract can write some descriptions of this class here.
*/
@interface MyClass : NSObject {
}
The relevant comments for the Property:property.
/*!
@property
@abstract Here you can write some basic descriptions of this property.
*/
@property (nonatomic, readonly) nsstring *hellodoctext_;
Method: A comment about the function (method).
/*!
@method
@abstract Here you can write some brief descriptions of this method
@discussion here can be specifically written about how to use this method, pay attention to the point and so on. If you are designing an abstract class or a
If the common class inherits from other classes, it is recommended to describe how to use this method here.
@param text text (listed here for the required parameters of this method)
@param error Errors Reference
@result return Results
*/
- (BOOL) showtext:(nsstring *) text
Error:(nserror *) error;
The relevant comments for the Enum:enum.
/*!
@enum
@abstract Some basic information about this enum
Tag of the @constant Hellodocenumdocdemotagnumberpopupview Popupview
@constant the tag of the Hellodocenumdocdemotagnumberokbutton OK button
*/
typedef Enum Hellodocenumdocdemo_{
Hellodocenumdocdemotagnumberpopupview =.
Hellodocenumdocdemotagnumberokbutton,
}hellodocenumdocdemo;
The relevant comments for the category:category.
/*!
@category
Category of @abstract NSString
*/
@interface kevinnsstring (nsstring)
Protocol:protocol Related Notes
/*!
@protocol
@abstract a protocol of this Hellodoc class
@discussion specific description information can be written here
*/
@protocol hellodocdelegate
Xcode generates comments using Vvdocumenter to generate a comment document by setting