分别记录破坏分配中的元素
在Swift中,您可以为这样的单个声明编写文档注释:
/// The title of the view.
private var title: String
当您将光标放置在使用> title
的情况下时,XCode会自动显示此文档。您可以使用MARKDOWN以及一些Swift特定的语义格式,如 nofollow noreferrer”>此nshipster文章。
是否可以单独记录由于这样的破坏分配而产生的变量?
private var (titlePromise, titleSeal) = Promise<String>.pending()
我尝试了我认为是显而易见的事情,
private var (
/// Promise that will resolve when we receive the view's title.
titlePromise,
/// Resolver function for the view's title.
titleSeal
) = Promise<String>.pending()
但是Xcode并未对这些评论进行接触。我发现可以将DOC评论放在两个之前,
/// Promise and resolver for the view's title.
private var (titlePromise, titleSeal) = Promise<String>.pending()
在这种情况下XCode将该文档应用于Promise> Promise
和seal
。这不是理想的,因为这些变量(相关)是单独用途的单独类型。
是否可以以Xcode可以拿起的方式在元组分配中分别记录(或全部)元素?
In Swift, you can write a documentation comment for a single declaration like this:
/// The title of the view.
private var title: String
This documentation is automatically displayed by Xcode when you put your cursor on a use of title
. You can use Markdown along with some Swift-specific semantic formatting, as described in this NSHipster article.
Is it possible to separately document the variables resulting from a destructuring assignment like this?
private var (titlePromise, titleSeal) = Promise<String>.pending()
I tried what I thought was the obvious thing,
private var (
/// Promise that will resolve when we receive the view's title.
titlePromise,
/// Resolver function for the view's title.
titleSeal
) = Promise<String>.pending()
but Xcode did not pick up on these comments. I found that it was possible to put a doc comment before both,
/// Promise and resolver for the view's title.
private var (titlePromise, titleSeal) = Promise<String>.pending()
in which case Xcode applies that documentation to both promise
and seal
. This is not ideal, since those variables—while related—are separate types with separate uses.
Is it possible to separately document both (or all) of the elements in a tuple assignment in a way that Xcode will pick up on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
即使我早些时候也有同样的要求,但我没有找到任何这样的解决方案。尽管Apple在编写不同类型的代码评论的帮助下提供了丰富的文档,但到目前为止,还没有办法为元组属性编写文档评论。但是,或者我遇到这样的写作。
Even I had same requirement earlier but I didn't found any such solution. Though apple providing the rich documentation with the help of writing different types of code commenting, till now there is no way of writing documentation comment for a tuple property. But, alternatively I come across writing like this.