What is the markup format for documentation on the parameters of a block in Swift?

混江龙づ霸主 提交于 2019-12-21 05:02:18

问题


The parameters of a block in Swift shows up with a table for parameters of the block if you add markup for documentation but I can not figure out how to fill out this table. I have searched for it in the Xcode markup reference formatting but I couldn't find anything on it.

Example:

/**
 Foo

 - parameter completion: A block to execute
 */
func foo(completion: (Bool) -> Void) {
    // do something
}

This is what shows up if I option + click in Xcode on the function above to view documentation:

Apple's APIs show the completion block parameter table filled out. This is an example of a CloudKit API documentation view:


回答1:


You have to give a name to the parameter, but precede it with an underscore:

/**
 Foo

 - parameter completion: A block to execute
 - parameter aflag: Some Bool flag
 */
func foo(completion: (_ aflag: Bool) -> Void) {
    // do something
}



来源:https://stackoverflow.com/questions/41969493/what-is-the-markup-format-for-documentation-on-the-parameters-of-a-block-in-swif

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!