如何在文档 Xcode 中添加对另一种方法的链接/引用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38321880/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:02:05  来源:igfitidea点击:

How to go about adding a link/reference to another method in documentation Xcode?

iosswiftxcodedocumentation

提问by Akshansh Thakur

I am adding some description to my method in class. This is how I achieved this:

我在课堂上为我的方法添加了一些描述。这就是我实现这一目标的方式:

enter image description here

在此处输入图片说明

And it looks like this upon clicking...

点击后看起来像这样......

enter image description here

在此处输入图片说明

How can I make the underlined method clickable? I want it to be referenced so that when a user clicks on it, they are directed to a particular web page for documentation.

如何使带下划线的方法可点击?我希望它被引用,以便当用户点击它时,他们被定向到特定的网页以获取文档。

Is it even possible? Thanks in advance, any help will be appreciated

甚至有可能吗?提前致谢,任何帮助将不胜感激

采纳答案by Akshansh Thakur

This linksolved my problem

这个链接解决了我的问题

Particularly, this is how I went about it

特别是,我就是这样做的

enter image description here

在此处输入图片说明

Thanks to Oleg for the link

感谢奥列格的链接

回答by Clay Ellis

You can link to another method by tagging it with /// - Tag:and referring to it by Tagusing the x-source-tag://[Tag]scheme like so:

您可以/// - Tag:通过Tag使用如下x-source-tag://[Tag]方案标记并引用它来链接到另一种方法:

/// - Tag: someMethod
func someMethod() {
   ...
}

/// Make sure to call [someMethod](x-source-tag://someMethod) at some point when overriding.
func otherMethod() {
   ...
}

Clicking on the someMethodlink in the Quick Help pop-over will take you to the method and flash-highlight it in yellow.

单击someMethod快速帮助弹出窗口中的链接将带您到该方法并以黄色闪光突出显示它。

回答by Vibha Singh

Use this

用这个

 /**
     *  <#Description#>
     *
     *  @link UILabel <#UILabel description#>
     *
     *  @return <#return value description#>
     */

Or you can try vvDocumenter for giving comments

或者您可以尝试 vvDocumenter 发表评论