我一直在使用Xcode 5的能力来记录我的代码与支持的注释语法(见这个问题)。Xcode 6支持Objective-C源,但不支持Swift源。
我想在。swift源代码上执行内联文档。知道怎么做或最佳实践吗?
提前感谢,
Luis
这里有一些在Xcode 6中记录swift代码的事情。它有很多bug,对冒号很敏感,但总比没有好:
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发布时,它可能会被支持。