What’s new in Xcode 7.给出了一个提示显示为丰富的快速帮助文本嵌入 图像和链接
降价的意见。
和Xcode的7测试版发行说明状态:
斯威夫特文档注释使用基于降价 格式的语法,具有丰富的操场评论对准他们。 (20180161)
后跟一个简短描述。
举个例子,
/**
Repeats a string `times` times.
:param: str The string to repeat.
:param: times The number of times to repeat `str`.
:returns: A new string with `str` repeated `times` times.
*/
func repeatString(str: String, times: Int) -> String {
return join("", Array(count: times, repeatedValue: str))
}
从http://nshipster.com/swift-documentation/现在将被写成
/// Repeats a string `times` times.
/// - Parameters:
/// - str: The string to repeat.
/// - times: The number of times to repeat `str`.
/// - returns: A new string with `str` repeated `times` times.
func repeatString(str: String, times: Int) -> String {
return Repeat(count: times, repeatedValue: str).joinWithSeparator("")
}
或用多行注释:
/**
Repeats a string `times` times.
- Parameter str: The string to repeat.
- Parameter times: The number of times to repeat `str`.
- returns: A new string with `str` repeated `times` times.
*/
func repeatString(str: String, times: Int) -> String {
return Repeat(count: times, repeatedValue: str).joinWithSeparator("")
}
有关降价的更多信息,请参阅
和许多
应用于内联文档的意见为好。
例如,您可以添加
**Important:** `times` must not be negative.
其中 “重要” 呈现强。
块参数的参数怎么样? –