General effect and grammar

AppleDoc can automatically generate documentation files similar to Apple official documentation based on the comments in the project, which looks something like this:




General Document catalog




A style

It looks pretty good, but AppleDoc has a few limitations. It requires comments in the code and only supports /**/, ///, //, etc. No #pragma mark-wkNavigationDelegate is supported.

/// This is a single line comment. /** This is also a single line comment */ /*! */ /** This is also a single line comment, * the second line will follow the first line. */ /** The first line is the introduction of the class. No spaced line breaks are eliminated, just as in Html. The following is a common markdown grammar - unordered list: (each row with a '*', '-', '+') : * This is the first line * this is the second line * this is the third line: (each line begins with 1.2.3, A.B.C): A. this is the first line B. this is the secode line * this is the first line a. this is line a b. this is line b * this is the second line 1. this in line 1 2. this is line Title 2: # This is an H1 ## This is an H2 ## This is an H3 #### This is an H4 ##### This is an h5 ###### This is an H6 A normal URL is written directly, appleDoc automatically translates to a link: http://blog.ibireme.com [this](http://example.net/) the link hides the actual URL. Form: | header1 | header2 | header3 | | -- -- -- -- -- -- -- -- - | : -- -- -- -- -- -- -- : | -- -- -- -- -- -- -- -- : | | normal | center | right | | cell | cell | cell | references: This will refer to the method 'someMethod:', Void CMYK2RGB(float c, float m, float y, float k, float *r, float *g, float *b) { *r = (1 - c) * (1 - k); *g = (1 - m) * (1 - k); *b = (1 - y) * (1 - k); } @property (nonatomic, strong) NSString *name; /** @brief This Tag cannot be placed in a class comment. @exception UIColorException @see YYColor @see someMethod So at sign warning, this is a warning, it's a blue box, at sign bug this is a bug, @param red 1 @param green 2 @param blue 3 @return */ - (UIColor) *)initWithRed:(int)red green:(int)green blue:(int)blue; - (void)someMethod:(NSString *)str; @endCopy the code
  • Github link: github.com/tomaz/apple…

The installation

git clone git://github.com/tomaz/appledoc.git
cd ./appledoc
sudo sh install-appledoc.shCopy the code

When you’re done, you can verify with AppleDoc –version.




use

  • First CD into your project folder. Running the following command will compile the docset and install it into Xcode by default.

    Appledoc –project-name Your project name –project-company Your company name./ Then a file will appear in your project folder













#appledoc Xcode script  
# Start constants  
company="ACME";  
companyID="com.ACME";
companyURL="http://ACME.com";
target="iphoneos";
#target="macosx";
outputPath="~/help";
# End constants

/usr/local/bin/appledoc \
--project-name "${PROJECT_NAME}" \
--project-company "${company}" \
--company-id "${companyID}" \
--docset-atom-filename "${company}.atom" \
--docset-feed-url "${companyURL}/${company}/%DOCSETATOMFILENAME" \
--docset-package-url "${companyURL}/${company}/%DOCSETPACKAGEFILENAME" \
--docset-fallback-url "${companyURL}/${company}" \
--output "${outputPath}" \
--publish-docset \
--docset-platform-family "${target}" \
--logformat xcode \
--keep-intermediate-files \
--no-repeat-first-par \
--no-warn-invalid-crossref \
--exit-threshold 2 \
"${PROJECT_DIR}"Copy the code



Ps: If there is an error in this step, just exit Xcode and compile again.

The generated directory package is in the docset-installed.txt










Ok, so that’s the whole process. It’s pretty convenient.

conclusion

The ability to automatically generate apple-like official documentation from comments is great, but it’s really convenient for developers to look directly at their own comments.

However, if you need to send a code report to your CTO or boss, this tool is handy. O O (studying studying)

I am a tumbling baby, welcome to comment ~