Swift标记:回调参数打断文档字符串

Swift标记:回调参数打断文档字符串,swift,xcode,documentation,markup,Swift,Xcode,Documentation,Markup,我正在使用文档记录类方法。一切顺利,但这里有一个微妙的问题 下面是一些例子来解释我的问题 1)一切看起来都很好 /// My Fancy Method. /// /// - Parameter number: A number. /// - Parameter flag: A flag. func methodWithoutCallback(integer number: Int, boolean flag: Bool) { } 2)仍然做得很好 /// A method with ca

我正在使用文档记录类方法。一切顺利,但这里有一个微妙的问题

下面是一些例子来解释我的问题


1)一切看起来都很好

/// My Fancy Method.
///
/// - Parameter number: A number.
/// - Parameter flag: A flag.
func methodWithoutCallback(integer number: Int, boolean flag: Bool) {

}

2)仍然做得很好

/// A method with callback (no arguments).
///
/// - Parameter string: A string.
/// - Parameter callback: A callback without arguments.
func methodWithVoidCallback(string name: String, _ callback: () -> ()) {

}
/**
The box now has a description

- Parameters:
  - callback: (Int) -> Int, I just like to define the type of callback here
  - value: Here is where you describe the value param of the callback

*/
func methodWithCallbackParameterAnnotated(callback: (_ value: Int) -> Int) {

}

3)不完全是我所期望的

/// This time things go wrong...
///
/// - Parameter number: A number.
/// - Parameter callback: Why there is a box with "No description" below?
func methodWithIntCallback(floating number: Float, _ callback: (Int) -> ()) {

}

4)使用typealias将删除该内容

typealias Callback = (Int) -> ()
/// And, there is a way to repair, but need typealias
///
/// - Parameter number: A number.
/// - Parameter callback: A callback (no box below)
func methodWithTypealiasedIntCallback(floating number: Float, _ callback: Callback) {

}


有人有这个问题吗?还是一种预期的行为?使用Xcode 9.2(9C40b)Swift 4(如果有必要)时会出现此问题


更新:似乎是的副本。但我想澄清一下:没有办法完全忽略这个盒子,对吗?因为如果使用建议的方法,您将得到以下结果:


您还需要在相同缩进级别定义回调中的所有参数

/// A method with callback (no arguments).
///
/// - Parameter string: A string.
/// - Parameter callback: A callback without arguments.
func methodWithVoidCallback(string name: String, _ callback: () -> ()) {

}
/**
The box now has a description

- Parameters:
  - callback: (Int) -> Int, I just like to define the type of callback here
  - value: Here is where you describe the value param of the callback

*/
func methodWithCallbackParameterAnnotated(callback: (_ value: Int) -> Int) {

}

的可能重复。我在Xcode 9.1中没有看到“表”。9.2中的新功能?@Sweeper不确定这个东西是什么时候引入的,但这是我第一次发现这种行为。Swift 5&Xcode 10:我刚刚遇到一个
@escaping
块:我给了它一个“u名称”和一个描述,它仍然在额外的框中显示整个东西。它为什么要这样做?如何使它像普通参数一样工作?