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

*一、Xcode 插件下载:*

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

Xcode常用插件下载:http://pan.baidu.com/s/1sjLnUFj

*二、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安装方法:*

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

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:

~/Library/Application Support/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:*

  1. Select top of your project in Project Navigator
  2. Click Add Target
  3. Depending on your project type (iOS or OS X) choose Aggregate Template
  4. Create new target. I suggest to call it Documentation
  5. Click on Build Phases and add new Build Phase based on Script
  6. Paste the script below into the script window
  7. Adjust variables in section “Start Constants” as required
  8. Uncomment correct ‘target’ for your project and comment out another one depending on your project type.
  9. Adjust path to appledoc binary and appledoc’s command-line switches if required
  10. When you ready to generate a docset from your project, build Documentation target.
  11. Docset will be installed into new loction and will become available to Xcode immediately.
  12. To refresh Quick Help (ALT+Click) and (ALT+double-click) you may need to restart Xcode to refresh its index cache.

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   --output ./doc --project-name spring3g_v525_test  --project-company "spring3s" --company-id "com.ch" .

或者

appledoc --no-create-docset  --output ./doc --project-name spring3g_v525_test  --project-company "spring3s" --company-id "com.ch" .

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

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

*六、appledoc Demo*

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

*七、参考链接:*

  1. https://github.com/onevcat/VVDocumenter-Xcode
  2. https://github.com/tomaz/appledoc
  3. https://github.com/tomaz/appledoc/blob/master/
  4. XcodeIntegrationScript.markdown
时间: 2024-10-07 10:37:08

Xcode常用插件使用及自动生成帮助文档的相关文章

vs2010代码注释自动生成api文档

最近做了一些接口,提供其他人调用,要写个api文档,可是我想代码注释已经写了说明,能不能直接把代码注释生成api?于是找到以下方法 环境:vs2010 先下载安装Sandcastle 和Sandcastle Help File Builder 下载地址 http://sandcastle.codeplex.com/ http://shfb.codeplex.com/ 其中Sandcastle Help File Builder安装较复杂,安装红框内的即可 安装完成后,然后让要使用的项目输出xml

webAPI 自动生成帮助文档

之前在项目中有用到webapi对外提供接口,发现在项目中有根据webapi的方法和注释自动生成帮助文档,还可以测试webapi方法,功能很是强大,现拿出来与大家分享一下. 先看一下生成的webapi文档. 1.下图展示的是生成帮助文档首页面,其中Values是controller,API下面的列表展示出请求的http方法(Get,POST等),请求的action,方法的描述. 2.点击红框内的链接,打开api方法的详情页面,如下图所示, 3.点击Test API打开如下页面 4.输入参数,点击S

eclipse中自动生成javadoc文档的方法

?这篇文章主要介绍了eclipse中自动生成javadoc文档的方法,是实用eclipse开发Java程序时非常实用的技巧,对于进行Java项目开发具有一定的参考借鉴价值,需要的朋友可以参考下 本文实例讲述了eclipse中自动生成javadoc文档的方法.分享给大家供大家参考.具体方法如下: 使用eclipse生成文档(javadoc)主要有三种方法: 1. 在项目列表中按右键,选择Export(导出),然后在Export(导出)对话框中选择java下的javadoc,提交到下一步. 在Jav

WebAPI——自动生成帮助文档

Web Api 自动生成帮助文档 新建Web Api项目之后,会在首页有API的导航菜单,点击即可看到API帮助文档,不过很遗憾,Description 是没有内容的. 怎么办呢? 第一步: 如果用VS2013 新建项目的(VS2012没试过),项目中会有 Areas/HelpPage 这样的目录,你没看错,文档就是这货生成的. 如果要是删除了或者,没有这个目录怎么办呢?没关系,你只需要使用NuGet添加  [Microsoft.AspNet.WebApi.HelpPage]这货,然后你就发现,

asp.net webAPI 自动生成帮助文档并测试

之前在项目中有用到webapi对外提供接口,发现在项目中有根据webapi的方法和注释自动生成帮助文档,还可以测试webapi方法,功能很是强大,现拿出来与大家分享一下. 先看一下生成的webapi文档. 1.下图展示的是生成帮助文档首页面,其中Values是controller,API下面的列表展示出请求的http方法(Get,POST等),请求的action,方法的描述. 2.点击红框内的链接,打开api方法的详情页面,如下图所示, 3.点击Test API打开如下页面 4.输入参数,点击S

Web API 自动生成帮助文档并使用Web API Test Client 测试

之前在项目中有用到webapi对外提供接口,发现在项目中有根据webapi的方法和注释自动生成帮助文档,还可以测试webapi方法,功能很是强大,现拿出来与大家分享一下. 先看一下生成的webapi文档. 1.下图展示的是生成帮助文档首页面,其中Values是controller,API下面的列表展示出请求的http方法(Get,POST等),请求的action,方法的描述. 2.点击红框内的链接,打开api方法的详情页面,如下图所示, 3.点击Test API打开如下页面 4.输入参数,点击S

Asp Net Core Swagger自动生成接口文档

Swagger是什么 Swagger工具为你的Asp Net Core生成漂亮的API文档.目前社会上大部分都是一个服务端为N个客户端提供接口,往往我们需要提供一个友好的API文档,Swagger的出现,几乎使得API文档完全自动化. 开始使用Swagger 此处我们使用开发IDE为VsCode,输入dotnet new webapi -o SwaggerDemo 创建ASP.NET Core Web API项目 添加Swashbuckle.AspNetCore包(此处不讨论包的安装方法,请自行

生成项目依赖包文档、自动生成接口文档

一. pipreqs模块生成依赖包文档 项目中通常会安装很多模块,为了移植性更好,我们可以使用pipreqs模块生成依赖包文档. 1.1 安装pipreqs模块 pip install pipreqs 1.2 生成对应项目的路径 切换至项目根目录,或者是给一个项目的路径: D:\youkutest\luffyapi>pipreqs ./ --encoding=utf8 上面项目名为luffyapi,后面加--encoding=utf8是防止因为编码问题报错,建议加上. 1.3 新环境中安装依赖包

DRF中自动生成API文档

自动生成api文档(不管是函数视图还是类视图都能显示) 1.安装rest_framework_swagger库 pip install django-rest-swagger 2.在项目下的 urls.py 中加入如下: from rest_framework_swagger.views import get_swagger_view schema_view = get_swagger_view(title='API文档') urlpatterns += [ path(r'docs/', sch