在Swift里为一个方法添加文档描述很简单,只需要用///就可以了,如:
/// Called when right button is clicked.
func imagePickerControllerDidSelectedAssets(images: [DKAsset]!)
看起来就是这样:
如果要描述方法参数,就作一个注释的空行,然后这样写:
/// Called when right button is clicked.
///
/// :param: images Images of selected
func imagePickerControllerDidSelectedAssets(images: [DKAsset]!)
一个带return的完整方法描述就这样写:
/// Called when right button is clicked.
///
/// :param: images Images of selected
/// :returns: void
func imagePickerControllerDidSelectedAssets(images: [DKAsset]!)
个人觉得比以前简洁方便了不少。