AppleDoc 安装步骤

AppleDoc 安装步骤

克隆项目
git clone git://github.com/tomaz/appledoc.git

打开appledoc.xcworkspace 编译通过后
修改以下文件
GBMethodData 删除第44行 后关闭项目

cd到appledoc.xcworkspace所在目录
执行下面命令
sh install-appledoc.sh

执行成功后,可使用下面命令查看是否安装成功
appledoc --version

接下来集成执行脚本到我们自己的项目中
集成步骤如下:

  1. File->New->Target 找到other->Aggregate
  2. 在该target中的Build Phases中添加Run Script,并添加下面的脚本
  3. 选中“Show enviroment variables in build log”,其他都取消选中。
  4. 此时编译Aggregate这个taget会报错,报错内容应该是:
    xcrun: error: unable to find utility "docsetutil", not a developer tool or in PATH
    解决方案是:https://github.com/swiftdocorg/docsetutil
    执行以下命令:
$ git clone https://github.com/SwiftDocOrg/DocSetUtil.git
$ cd DocSetUtil
$ make install

脚本内容:见 AppleDoc 使用介绍

此时再次编译,不出意外会直接生成。

接下来就打开目录$outputPath(项目的上一层Document文件夹下)
会看到一个txt文件和两个文件夹,打开txt文件,里面会有个文件目录,docset文件就在该目录下。

Docset文件可以用Dash文件打开,官网下载地址:https://kapeli.com/dash

将docset文件拖到Dash就可以搜索查看了。

使用AppleDoc需要按照下面的规则给代码添加备注:
https://www.cocoanetics.com/2011/11/amazing-apple-like-documentation/
脚本使用介绍:
https://github.com/tomaz/appledoc/blob/master/XcodeIntegrationScript.markdown

http://www.cnblogs.com/PaulpauL/ 版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:https://www.cnblogs.com/PaulpauL/p/15237823.html