簡介
appledoc 是一個(gè)命令行工具,它可以幫助 Objective-C 開發(fā)者從特殊格式的源代碼注釋中生成類似 Apple 的源代碼文檔踊挠。它的設(shè)計(jì)目的是在輸入時(shí)盡可能采 HTML 格式文檔凸丸,以及完全索引和可瀏覽的 Xcode 文檔集。
安裝appledoc
- 下載代碼
git clone git://github.com/tomaz/appledoc.git
- 進(jìn)入目錄
cd ./appledoc
- 執(zhí)行安裝腳本
sudo sh install-appledoc.sh
- 檢驗(yàn)是否安裝成功
appledoc --version
遇到問題
-
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
解決:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
-
The following build commands failed: Ld /tmp/Build/Intermediates.noindex/ArchiveIntermediates/appledoc/IntermediateBuildFilesPath/appledoc.build/Release/appledoc.build/Objects-normal/x86_64/Binary/appledoc normal x86_64 (in target 'appledoc' from project 'appledoc')
(1 failure)解決:
- 打開編譯腳本 /appledoc/install-appledoc.sh
- 只編譯arm64 ARCHS="arm64"
xcodebuild -workspace appledoc.xcworkspace -scheme appledoc ARCHS="arm64" -derivedDataPath /tmp -configuration Release install
指令用法
- 參考指令寫法1(不生成docset文件)
$ appledoc --no-create-docset --output ./doc --project-name "工程名" --company-id "bundle id" --project-company "公司名" ./
- 參考指令寫法2(不生成docset文件九默,參數(shù)使用“=”等號(hào)寫法)
$ appledoc --no-create-docset --output="./doc" --project-name="工程名" --company-id="bundle id" --project-company="公司名" ./
- 參考指令寫法3(生成docset文件并指定生成路徑)
$ appledoc --output ./doc --project-name "工程名" --company-id "bundle id" --project-company "公司名" ./ --docset-install-path ./doc
支持的注釋
/// 這是單行注釋蒸殿。
/** 這也是單行注釋 */
/*! 同樣是單行注釋 */
/** 這也是單行注釋,
* 第二行會(huì)接上第一行恬总。
*/
/** 第一行是類的簡介
在簡介的下面,就是類的詳細(xì)介紹了前普。
沒有間隔換行會(huì)被消除,就像Html那樣壹堰。
下面是常用的markdown語法
- - -
無序列表: (每行以 '*'拭卿、'-'、'+' 開頭):
* this is the first line
* this is the second line
* this is the third line
有序列表: (每行以 1.2.3贱纠、a.b.c 開頭):
a. this is the first line
b. this is the secode line
多級(jí)列表:
* 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 2
標(biāo)題:
# This is an H1
## This is an H2
### This is an H3
#### This is an h4
##### This is an h5
###### This is an H6
鏈接:
普通URL直接寫上峻厚,appledoc會(huì)自動(dòng)翻譯成鏈接: [http:// blog.ibireme.com](http:// blog.ibireme.com)
[這個(gè)]([http://example.net/](http://example.net/)) 鏈接會(huì)隱藏實(shí)際URL.
表格:
| header1 | header2 | header3 |
|---------|:-------:|--------:|
| normal | center | right |
| cell | cell | cell |
引用:
這里會(huì)引用到方法
someMethod:,這里會(huì)引用到類
YYColor``
這里會(huì)引用到一個(gè)代碼塊
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);
}
@since iOS5.0
*/
@interface AppledocExample : NSObject
///這里是屬性的說明
@property (nonatomic, strong) NSString *name;
/**
@brief 這里是方法的簡介谆焊。該Tag不能放到類注釋里惠桃。
@exception UIColorException 這里是方法拋出異常的說明
@see YYColor
@see someMethod:
@warning 這里是警告,會(huì)顯示成藍(lán)色的框框
@bug 這里是bug辖试,會(huì)顯示成黃色的框框
@param red 這里是參數(shù)說明1
@param green 這里是參數(shù)說明2
@param blue 這里是參數(shù)說明3
@return 這里是返回值說明
*/