Category

Swift documentation

Swift Language

In the release notes for XCode 6 beta 5, they mention that they are using reStructuredText (quick reference) for javadoc style documentation.

It has a long way to go, but it’s a start.

Like Java, you can create documentation blocks like this:

N.B. For old timey Objective-C guys, HeaderDoc uses /*! instead of /**

Or you can use three virgules (///) at the beginning of a line for single liners. Open Quick Help Inspector to see the comments, or option click on a variable/func of the type you’re documenting.

The notes state

Currently only block-level markup is supported (nested bullet and enumerated lists, field lists) [are supported].

Let’s see some field lists

How about bullet lists? Yes they work.

Enumerated lists? Not so much, even though they say they do. And other formatting like *bold* and **bolder** doesn’t work (they didn’t say it would yet).

You can use field lists for param and returns like this:

Formatting code in your comments? I don’t see anything yet. Also, in build settings, you can ask to be warned about Documentation Comments that are invalid. That doesn’t work for these comments yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.