Adding Structured Markup

Swift structured markup uses a standardized annotation template to support automatic documentation generation. Similar to other structured documentation systems like Doxygen, reStructuredText, Javadoc, Pydoc, and so forth, you embed API details into triple-slash (///) comments or double-asterisk (/** */) comment blocks:

 /// Unsafely turns an opaque C pointer into an
 /// unmanaged class reference.
 ///
 /// This operation does not change reference counts.
 ///
 /// let str: CFString = Unmanaged.fromOpaque(ptr)
 /// .takeUnretainedValue()
 ///
 /// - Parameter value: An opaque C pointer.
 /// - Returns: An unmanaged class reference to `value`.

Swift markup includes keywords like Parameter, Returns ...

Get Swift Style, 1st Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.