Documenting code
In AppCode, you can generate and view documentation for your Swift and Objective-C code. For Objective-C, you can add HeaderDoc, Doxygen, and appledoc comments and generate full-fledged documentation in various formats using corresponding tools. For Swift, the Markdown syntax is available for code documentation formatting.
Generate comments
Place the caret before the declaration of a method or function that you want to document and do the following:
For Objective-C: depending on the comment style you want to use, type
///
,//!
,/**
, or/*!
and press ⏎:For Swift: type
///
or/**
and press ⏎.
View documentation
Place the caret at the symbol you want to view documentation for and press ⌃ Q. If the symbol is supplied with proper documentation comments or SDK documentation, the Quick Documentation popup appears:
If you want documentation to be shown in a tool window, press ⌃ Q twice. Press ⌃ Q twice to switch between the popup and tool window modes.
If you want documentation to be shown on mouse hover, select the Show quick documentation on hover checkbox in .
Reliable rename
While renaming a function or its parameters, the documentation comments need to be updated accordingly. In case of the Rename refactoring ⇧ F6, AppCode updates documentation comments along with other references.
Typing assistance
Basic typing assistance for documentation comments is provisioned by AppCode auto-complete feature:
Rendered view for Objective-C documentation comments
With AppCode, Objective-C documentation comments can be shown in an easier-to-read format. In this Rendered View mode, items are shown grouped by their tags, while the tags themselves are skipped.
Note the rendered view limitations:
Opening the referenced web pages is not available.
EOL block comments are rendered only if they start the line.
Toggle and configure the rendered view
To enter the Rendered View mode, hover the mouse pointer over a comment and click in the gutter or press ⌃ ⌥ Q. The icon turns into .
To quit the Rendered View mode, click in the gutter, or select Toggle Rendered View from the context menu of a Objective-C documentation comment, or press ⌃ ⌥ Q.
To turn on the Rendered View mode for all Objective-C documentation comments in the current file, select Render All Doc Comments from the context menu in the gutter.
If necessary, select Adjust Font Size from the context menu and change the font size using the slider.
To show all Objective-C documentation comments rendered by default, open the Preferences dialog ⌃ ⌥ S, go to , and select the Render documentation comments checkbox.
To hide the Rendered View gutter icons, select Configure Gutter Icons from the context menu in the gutter and then clear the Documentation comments in-place rendering checkbox on the page that opens.