Embellish your documentation

If you have started documenting your functions, you may be wondering if there are other formats to apply. Well, wonder no more: behold some tips to embellish your already beautiful documentation.

Italics

Any of these comments…

/// *You can use Italics* for your comments

/// _You can use Italics_ for your comments

… will render like this:

Bold

Any of these comments…

/// **You can use bold** for your comments too!

/// __You can use bold__ for your comments too!

… will render like this:

Bulleted lists

This comment…

/// * You can add a bullet list
/// + You can also use a plus sign
/// - You can also use a hyphen

… will render like this:

Numbered lists

This comment…

/// You can add a numbered list:
/// 1. First item
/// 2. Second item
/// 3. Third item

… will render like this:

Links

This comment…

/// You can even add a link!
/// Very useful to add [the source of your solution](https://stackoverflow.com/questions/26061725/combining-tab-bar-navigation-and-table-view-controllers/26061909#26061909)

… will render like this:

Code

This comment…

/// You can add an `inline code` easily. Very useful to write types like `Int`, `Float` or `String`.
///
/// But you can also write a piece of code like this:
/// ```
/// let sum = sumTwoIntegers(number1: 23, number2: 12)
/// ```

… will render like this:

Separators

This comment…

/// You can make a separator using three asterisks:
/// ***
///
/// or using three hypens:
///
/// ---
///
/// or using three underscores:
/// ___

… will render like this:

What now?

Found something useful? Spread the word!

Want to embellish your documentation? Check this out! #swift #documenting #markdown #ios

Leave a Reply

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