美文网首页
xcode 输出std API文档以及注释

xcode 输出std API文档以及注释

作者: wusa | 来源:发表于2018-05-16 14:43 被阅读0次

/*!
@enum
@abstract 关于这个enum的一些基本信息
@constant HelloDocEnumDocDemoTagNumberPopupView PopupView的Tag
@constant HelloDocEnumDocDemoTagNumberOKButton OK按钮的Tag
*/
typedef enum HelloDocEnumDocDemo_{
HelloDocEnumDocDemoTagNumberPopupView = 100,
HelloDocEnumDocDemoTagNumberOKButton,
}HelloDocEnumDocDemo;

*!
@protocol
@abstract 这个HelloDoc类的一个protocol
@discussion 具体描述信息可以写在这里
*/
@protocol HelloDocDelegate <NSObject>

@end

/*!
@class
@abstract 这里可以写关于这个类的一些描述。
*/
@interface ViewController : UIViewController

/*!
@property
@abstract 这里可以写关于这个Property的一些基本描述。
*/
@property (nonatomic,readonly) NSString *helloDocText_;

/*! @brief This property knows my name. */
@property (nonatomic, strong) NSString *myName;

/*!
@method
@abstract 这里可以写一些关于这个方法的一些简要描述
@discussion 这里可以具体写写这个方法如何使用,注意点之类的。如果你是设计一个抽象类或者一个
共通类给给其他类继承的话,建议在这里具体描述一下怎样使用这个方法。
@param text 文字 (这里把这个方法需要的参数列出来)
@param error 错误参照
@result 返回结果
*/

  • (BOOL)showText:(NSString *)text
    error:(NSError **)error;

/*!
@brief It converts temperature degrees from Fahrenheit to Celsius scale.

@discussion This method accepts a float value representing the temperature in Fahrenheit scale and it converts it to the Celsius scale.

To use it, simply call @c[self toCelsius: 50];

@param fromFahrenheit The input value representing the degrees in the Fahrenheit scale.

@return float The degrees in the Celsius scale.
*/
-(float)toCelcius:(float)fromFahrenheit;

/*!
@brief It converts temperature degrees from Celsius to Fahrenheit scale.

@param fromCelcius The celsius degrees value.

@return float The degrees in the Fahrenheit scale.

@code
float f = [self toCelsius:80];
@endcode

@remark This is a super-easy method.
*/
-(float)toFahrenheit:(float)fromCelcius;

@end
/*!
@category
@abstract NSString的Category
*/
@interface KevinNSString (NSString)

@end

注释完了就可以到处高大上的api文档了,生成技术文档主要有三个工具: headerdoc, doxygen 和 appledoc.其中headerdoc是苹果官方的生成工具,后两个是第三方工具(引用).
1.打开终端 2. cd 打开项目
输入:headerdoc2html -o OutputDirectory(文件输出的路径) InputDirectory(输入的文件这里指的是项目文件夹)路径拖拽即可
3.enter 等待完成。

苹果官方文档
https://developer.apple.com/library/ios/navigation/#section=Resource%20Types&topic=Guides

相关文章

网友评论

      本文标题:xcode 输出std API文档以及注释

      本文链接:https://www.haomeiwen.com/subject/czikwxtx.html