在Xcode中创建"快速帮助"条目

m J*_*Jae 33 xcode doxygen objective-c code-comments code-documentation

如何在Xcode中为我自己的代码创建快速帮助条目?我只是想把它作为编码支持,就像编写Java时的Eclipse功能一样.在eclipse中,当您将方法悬停在其他位置时,您会在方法上方输入注释.

Xcode等效似乎是"快速帮助".

除了使用Doxygen之外真的没别的办法吗?对于我正在研究的小项目来说,Doxygen似乎有些过分.目前我确实知道我只想彻底填写快速帮助,所以请避免任何提示,"你必须为你的项目创建一个文档".

我真的很感激任何帮助,因为我在这个主题上唯一能找到的就是这个问题.

但正如您所看到的,没有可用的解决方案.

Ale*_*ray 28

是的......你可以......这是一个现成的"Snippet",你可以拖动或自动完成等等......

/** 
 * <#summary#>
 * @param <#name#> <#how you gonna get it?#>
 * @param <#name#> <#really, there's more?#>
 * @return <#name#> <#what do you want!#>
 */
Run Code Online (Sandbox Code Playgroud)

拖动"上"片段"东西",就像,你知道..设置它.. 在此输入图像描述

而且你有...

在此输入图像描述


lkr*_*der 9

我认为唯一的方法是为您的代码创建一个文档集,然后将其安装在XCode上:

Xcode 4的上下文帮助,Apple称之为"快速帮助",完全依赖于已安装的文档集.Xcode 4自动下载Mac OS和iOS API的文档集(包括更新),但您也可以安装第三方集.

(......)

创建文档集后,可以将其安装在Xcode的首选项中(在"文档"选项卡下).假设正确构建和安装了文档集,快速帮助应该"正常工作".当然,除非您与群组或广泛的世界共享复杂的API,否则这种用途有限.

来源:http://xcodebook.com/2011/04/providing-your-own-quick-help/

Apple的文档集指南:http: //developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/Documentation_Sets/


cbo*_*wns 6

从Xcode 5.0开始,变量和方法的Doxygen和HeaderDoc格式在"快速帮助"弹出窗口中自动解析和呈现.关于它的更多信息,在这里,但这里的一些关键位:

/**
 * Add a data point to the data source.
 * (Removes the oldest data point if the data source contains kMaxDataPoints objects.)
 *
 * @param aDataPoint An instance of ABCDataPoint.
 * @return The oldest data point, if any.
 */
 - (ABCDataPoint *)addDataToDataSource:(ABCDataPoint *)aDataPoint;
Run Code Online (Sandbox Code Playgroud)

在Xcode中呈现为:

至于属性,它就像:

/// Base64-encoded data.
@property (nonatomic, strong) NSData *data;
Run Code Online (Sandbox Code Playgroud)

当选项单击时,会出现这个可爱的弹出框:


mem*_*ons 5

Xcode 5现在内置了对DOxygen风格注释的支持.所以,你可以这样评论你的方法:

/*!
 * Provides an NSManagedObjectContext singleton appropriate for use on the main 
 * thread. If the context doesn't already exist it is created and bound to the 
 * persistent store coordinator for the application, otherwise the existing 
 * singleton contextis returned.
 * \param someParameter You can even add parameters
 * \returns The a shared NSManagedObjectContext for the application.
 */
+ (NSManagedObjectContext *)sharedContext;
Run Code Online (Sandbox Code Playgroud)


内联帮助将如下所示:

内联帮助



快速帮助将如下所示:

快速帮助



侧边栏帮助将如下所示:

侧栏帮助

这是一个方便的代码片段,您可以添加Xcode代码片段库以简化方法文档:

/**
 <#description#>
 @param <#parameter#>
 @returns <#retval#>
 @exception <#throws#>
 */
Run Code Online (Sandbox Code Playgroud)

doxygen代码片段

现在,你可以输入"doxy"和poof!你有你的doxygen模板.