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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.