Xcode常用插件使用及自动生成帮助文档

*一、Xcode 插件下载:*

VVDocumenter下载: https://github.com/onevcat/VVDocumenter-Xcode

Xcode常用插件下载:

*二、VVDocumenter安装方法:*

The best way of installing is by Alcatraz. Install Alcatraz followed by the instruction, restart your Xcode and press 9. You can find VVDocumenter-Xcode in the list and click the icon on left to install.

If you do not like the Alcatraz way, you can also clone the repo. Then build the VVDocumenter-Xcode target in the Xcode project and the plug-in will automatically be installed in ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins. Relaunch Xcode and type in /// above any code you want to write a document to.

If you want to use other text beside of /// to trigger the document insertion, you can find a setting panel by clicking VVDocument in the Window menu of Xcode. You can also find some other useful options there, including setting using spaces instead of tab in the panel or changing the format of generated documentation.

开发中我遇到的问题:下载Xcode常用插件并解压至~/Library/Application Support/Developer/Shared/Xcode/Plug-ins,Xcode6.2下其它插件均可使用,唯独VVDocumenter不行。百思不得其解。后来安装了Alcatraz,VVDocumenter才能使用。

*三、appledoc安装方法:*

appledoc下载:https://github.com/tomaz/appledocappledoc安装:

The recommended way is to clone GitHub project and compile the tool from Xcode. As cloning GitHub project will create the link to the main repository, it greatly simplifies future upgrading too. To install, type the following in the Terminal:

git clone git://github.com/tomaz/appledoc.git

This creates appledoc directory. Within you can find appledoc.xcodeproj Xcode project; open it and compile appledoc target – this should work out of the box, however your system must meet minimum system requirements, see below. I recommend you copy resulting appledoc executable from build directory to one of the directories in your path (echo $PATH) to make it easily accessible.

Optional: Appledoc is selfcontained and contains the necessary template files. IF you want to modify these default from Templates subdirectory to one of the expected locations:

~/appledoc~/.appledoc

You can also use install-appledoc.sh script to perform quick installation. Open Terminal and switch to appledoc directory. Type following command:

sudo sh install-appledoc.sh (if you need templates add ‘-t default’) It compiles appledoc and installs its binary to /usr/local/bin and templates (if wanted) to ~/.appledoc by default. You can override this directories with -b and -t options respectively. For example:

sudo sh install-appledoc.sh -b /usr/bin -t ~/Library/Application\ Support/appledoc

Alternatively with Homebrew:

brew install appledoc

Homebrew does not install templates by default.

*四、appledoc整合Xcode:*

Below is a working script that can be added to the Xcode Build Phases, Run Script

#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}”

注:target=”iphoneos”,引号里内容换成你的工程target名,否则build会有错。Build成功后,在Xcode打开 -> help -> Documentation And API Reference,即可查看生产的工程帮助文档。此方法一。

*五、appledoc使用方法(命令行控制)*

在命令行工具cd到工程所在路径,然后键入

appledoc company

或者

appledoc output company

这样在工程目录下即生成doc文件夹。doc文件夹下有注释网页文档。

注:”.“ 和前面的符号一定要加 空格 否则就会报错。–company-id参数也要传。添加–no-create-docset参数,,会在./doc目录下生成网页文档。./doc目录下docset-installed.txt文件记录了生成help Documentation保存路径。

*六、appledoc Demo*

Demo下载:https://github.com/JarryChang/AppledocDemo

*七、参考链接:*

从一开始就提醒自己,世上没有后悔药吃。

Xcode常用插件使用及自动生成帮助文档

相关文章:

你感兴趣的文章:

标签云: