在xcode註解規則:
@brief (建議必寫) - 大綱簡易說明 @param <name> <description> (建議必寫) – 參數說明 @return <description> (建議必寫) – 回傳說明 @exception <name> <description> – 例外說明 @see <name> – 參考 @warning <text> – 警告說明 @bug <text> – 錯誤說明
單行簡易註解
/// This a simple method with out return any result.- (void)simpleMethod;
|
多行簡易註解
/** * @brief This a complex method with two parameters. * More detail descriptions can write below "@" sign... * * @param value1 The value of integer. * More detail description for value1... * * @param value2 The value of CGFloat. * More detail description for value2... * * @return Retrun a result Object. * More detail descroption for return value... */- (NSObject *)complexMethodWithParam1:(int)value1 param2:(CGFloat)value2;
|
多行完整註解
/** * @brief This a full version of comment description. * * @param value The vale of integer. * * @return Return a result Object. * * @exception NSException Put exception message here. * * @see simpleMethod * @see complexMethodWithParam1:param2: * * @warning You can write some message about some warning things. * * @bug If this method has any bug, please write here. */- (NSObject *)DetailComplexMethodWithParam:(int)value;
|
xcode 註解文件生成方式:
安裝appledoc:
首先先到 Terminal 終端機中敲入以下指令:
|
git clone git://github.com/tomaz/appledoc.gitcd appledocsudo sh install-appledoc.sh
|
若是你有遇到 could not stat active Xcode path ‘/Volumes/Xcode/Xcode.app/Contents/Developer’. (No such file or directory) 這個錯誤訊息,那你可以嘗試執行這段,之後再執行 install:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
|
生成文件方式:
appledoc --output [輸出目錄] --project-name [專案名稱] --project-company [公司名稱] --company-id [公司app id] --no-warn-undocumented-object --keep-intermediate-files [專案目錄]
|
例如: appledoc --output ~/Desktop/doc --project-name "appledocDemo" --project-company "Anistar Studio" --company-id "com.riaproject" --no-warn-undocumented-object --keep-intermediate-files ~/Documents/iOS_Project/AppleDocDemo/
|
參考來源:在-ios-專案中寫注解的技巧
留言列表