The parameters of a block in Swift shows up with a table for parameters of the block if you add markup for documentation but I can not figure out how to fill out this table. I have searched for it in the Xcode markup reference formatting but I couldn't find anything on it.
Example:
/**
Foo
- parameter completion: A block to execute
*/
func foo(completion: (Bool) -> Void) {
// do something
}
This is what shows up if I option + click
in Xcode on the function above to view documentation:
Apple's APIs show the completion block parameter table filled out. This is an example of a CloudKit API documentation view:
Use markup to create playgrounds that show formatted text in rendered documentation mode and to show Quick Help for your Swift code symbols. Markup for playgrounds includes page level formatting for headings and other elements, formatting spans of characters, showing inline images, and several other features.
Markup for Swift symbols is used for Quick Help and for the description shown in symbol completion. For example, the description in the markup in Figure 1-2 is used for the description in symbol completion shown in Figure 1-3 .
Markup Syntax. Markup uses simple Markdown-like character delimiter syntax with custom extensions. There are four types of elements: Single line elements format a line of text such as creating a heading. Multiline elements format multiple lines of text such as creating lists or callouts.
The Swift standard library defines a base layer of functionality for writing Swift programs. Documentation for the standard library is presently hosted on the Apple Developer website. There are a number of packages that are part of the core Swift project. Below is a list of packages that currently offer hosted documentation.
You have to give a name to the parameter, but precede it with an underscore:
/**
Foo
- parameter completion: A block to execute
- parameter aflag: Some Bool flag
*/
func foo(completion: (_ aflag: Bool) -> Void) {
// do something
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With