1

I know how to document the parameter name of a function like:

/**
 - parameters:
   - param: the parameter
 */
func myFunc(param: Int) {...}

but I am unable to document the argument label (either with or without the parameter name):

/**
 - parameters:
   - label: the label
   - param: the parameter
 */
func myFunc(label param: Int) {...}

After all, documenting the label is more important than the parameter name, as it is what is used at function calls.

Note: I've been unable to find the trick in Apple's documentation, or I did I miss something?

1 Answer 1

1

You cannot directly refer to the argument label in the documentation of a function.

As a workaround, you can mention the label in the description of the parameter, like this:

/**
 - parameters:
     - param: (argument label: `label`) the parameter
 */
func myFunc(label param: Int) {...}

With the usage of back-ticks, it blends in nicely with the parameter itself:

example function documentation

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.