Swift code comment special words

Swift can help you a lot to document your code – it allows you to use markup. However, in order to use it not only as formatted text but as source code commentary, it is nice to use the special keywords known.

I created my own cheat sheet for these keywords, which create their own left column or blocks. Always use them with a preceding minus, like this

– returns: the object or nil, if not successful

  • returns:
  • throws:
  • parameter <param>:
  • parameters:
    • <param1>:
    • <Param2>:

You can also use the following keywords to have bold text formatted inside the description block:

  • Author:
  • important:
  • version:
  • Attention:
  • todo:

For more keywords, see the reference, linked above.