首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Swift文档评论

Swift文档评论
EN

Stack Overflow用户
提问于 2018-04-17 03:35:50
回答 2查看 0关注 0票数 0

我有几个关于Swift文档评论的问题。

  1. 要制作一些Apple文档中的相关声明部分。例如,当我选择并单击tablewView(_:heightForRowAtIndexPath :)方法时,它将链接到生成文档中的其他3个相关方法。
  2. 在swift中是否有警告标签?我知道在Objective-C中它允许你执行@警告并在生成的文档中获得粗体警告。但是,警告:在快速文档评论中没有做任何事情,所以我很好奇是否有其他方法。
  3. 有什么方法可以将文档制作成与Apple文档类似格式的HTML文件。在其他IDE中,我知道其他语言(如Eclipse),你可以为你的代码生成html文档。XCode有这个吗?
EN

回答 2

Stack Overflow用户

发布于 2018-04-17 11:44:13

可以使用标记来编写playground和代码文档注释。

  • 对于丰富的操场文件使用//:/*: */
  • 对于代码文档使用////** */

代码语言:javascript
复制
/// This function returns a *hello* string for a given `subject`.
///
/// - Warning: The returned string is not localized.
///
/// Usage:
///
///     println(hello("Markdown")) // Hello, Markdown!
///
/// - Parameter subject: The subject to be welcomed.
///
/// - Returns: A hello string to the `subject`.
func hello(subject: String) -> String {
    return "Hello, \(subject)!"
}

票数 0
EN

Stack Overflow用户

发布于 2018-04-17 13:03:52

Xcode 7.0 beta 4

代码语言:txt
复制
/// Creates the string representation of the poo with requested size.
///
/// - warning: Be carefull! Poos can hurt.
/// - parameter size: requested size of the poo
/// - returns: string representation of the poo
func makePoo(size: String) -> String
{
    return "Ouch. This is \(size) poo!"
}

看起来就像这样:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100008135

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档