我知道你可以使用///(三次斜杠)来评论变量,甚至可以使用/**
对函数等进行doxygen样式注释,但有没有办法记录自定义类本身?所以如果有人在Xcode中选择点击它会有描述吗?
答案 0 :(得分:0)
我遇到了同样的问题并找到了解决方案。
如果要使用Doxygen对自定义类进行注释,请使用@file标记(或\ file标记)。 (这是Doxygen Document站点中推荐的方法,但它经常被忽略。)
使用标记
就是这样。
例如:
/*!
@file CustomViewController.h
*/
#import <UIKit/UIKit.h>
/*!
@brief The CustomViewController Header file
@discussion CustomVC
@superclass SuperClass: UIViewController
@classdesign No special design is applied here.
@coclass AppDelegate
@helps It helps no other classes.
@helper No helper exists for this class.
@author dakeshi
@version 1.0
*/
@interface CustomViewController : UIViewController
**我用Xcode 6.2测试了这段代码
您可以识别@file标签是分开的。如果我在第二个注释块中移动@file标记,Doxygen无法生成我想要的文档。它只能完美地工作@file标签。(我找不到原因。)
您可以在第二个注释块中使用@class,@ protocol标签,但您需要非常小心地使用它。有些标签必须与换行符一起使用(例如@discussion,@ class),因为Apple保留了与某些标签同名的关键字。如果你在上面的例子中使用没有换行符的@class标签,你就可以看到关于UIViewController的普通苹果文档。
答案 1 :(得分:-2)
您可以使用不同的方式进行记录,例如
/*!
* @discussion <#description#>
* @param <#param description#>
* @return <#return description#>
*/
查看@discussion
关键字的详细说明以及如何使用以下链接中的代码段快速使用这些评论
http://www.raywenderlich.com/66395/documenting-in-xcode-with-headerdoc-tutorial