Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add links to Swift classes in the quick help documentation comments?

Assume I have two classes:

/**
  This class should be used together with [Foo]( ??? ).
*/
class Bar {
    func doNothing() {}
}

/**
  Description of what Foo does goes here.
*/
class Foo {
    func doNothing() {}
}

I want to create a link to Foo or Foo's quick help from Bar's quick help in Xcode. Is it even possible? If so, how?

The [name](target) syntax for links isn't up to snuff as far as I can tell by looking at Apple's docs and more Apple's docs.

like image 972
Cybotaur Avatar asked Apr 26 '17 13:04

Cybotaur


People also ask

How do you write a documentation comment in Swift?

Type /// or /** */ to begin a documentation comment and then use DocC's special dialect of Markdown to write the content. This dialect supports many keywords like - Parameters: for describing function arguments or - Returns: for describing return values.

How do you comment a class in Swift?

Swift comments can be written in two formats: Each line is preceded by a triple slash (///) Javadoc-style block comments (/** … */)

How do you add a comment to a swift code?

There are two ways to add comments in Swift: // - Single Line comments. /*... */ - Multiline Comments.

How do I write documents in Xcode?

You can use ⌥ + ⌘ + / (option + command + ) to add function documentation.


1 Answers

I just stumbled upon this. Apparently, if the text you enclose in backticks happens to be a class, it will be rendered as a hyperlink to the class.

like image 158
edburns Avatar answered Dec 11 '22 08:12

edburns