如何在 XCode 中记录参数标签而不是 Swift 函数的参数名称?

How to document argument label and not parameter name of Swift function in XCode?

我知道如何记录函数的参数名称,例如:

/**
 - parameters:
   - param: the parameter
 */
func myFunc(param: Int) {...}

但我无法记录参数标签(有或没有参数名称):

/**
 - parameters:
   - label: the label
   - param: the parameter
 */
func myFunc(label param: Int) {...}

毕竟,记录标签比参数名称更重要,因为它是在函数调用时使用的。

注意:我一直无法在 Apple 的文档中找到诀窍,还是我遗漏了什么?

不能直接引用函数文档中的参数标签

作为解决方法,您可以在参数说明中提及标签,如下所示:

/**
 - parameters:
     - param: (argument label: `label`) the parameter
 */
func myFunc(label param: Int) {...}

随着 back-ticks 的使用,它与参数本身很好地融合在一起: