【发布时间】:2014-08-19 22:42:27
【问题描述】:
我一直在使用 Xcode 5 以支持的注释语法 (see this SO question) 来记录我的代码。 Xcode 6 通过 Objective-C 源代码支持它,不幸的是不支持 Swift 源代码。
我想在 .swift 源上执行内联文档。知道如何做或最佳做法吗?
提前致谢,
路易斯
【问题讨论】:
标签: swift xcode6 code-documentation
我一直在使用 Xcode 5 以支持的注释语法 (see this SO question) 来记录我的代码。 Xcode 6 通过 Objective-C 源代码支持它,不幸的是不支持 Swift 源代码。
我想在 .swift 源上执行内联文档。知道如何做或最佳做法吗?
提前致谢,
路易斯
【问题讨论】:
标签: swift xcode6 code-documentation
这里有一些可以在 Xcode 6 中记录 swift 代码的东西。它有很多错误并且对冒号很敏感,但总比没有好:
class Foo {
/// This method does things.
/// Here are the steps you should follow to use this method
///
/// 1. Prepare your thing
/// 2. Tell all your friends about the thing.
/// 3. Call this method to do the thing.
///
/// Here are some bullet points to remember
///
/// * Do it right
/// * Do it now
/// * Don't run with scissors (unless it's tuesday)
///
/// :param: name The name of the thing you want to do
/// :returns: a message telling you we did the thing
func doThing(name : String) -> String {
return "Did the \(name) thing";
}
}
上面的内容在快速帮助中呈现,正如您对格式化数字列表、项目符号、参数和返回值文档的期望一样。
这些都没有记录 - 提交雷达以帮助他们。
【讨论】:
看来你还可以添加功能描述:
/**
This is a description of my function
*/
func myFunc() {
}
///this is a description of my second function
func myFunc2(){
}
但目前不支持任何 headerdoc 标记。它可能会在 Xcode 6 发布时得到支持。
【讨论】: