This question is for reference purposes.
In the "Fonts & Colors" tab of the Settings window of Xcode, there's a setting for documentation comments (and keywords)? What are they?
Type /// or /** */ to begin a documentation comment and then use DocC's special dialect of Markdown to write the content. This dialect supports many keywords like - Parameters: for describing function arguments or - Returns: for describing return values.
6. Comments By selecting a few lines of code (pressing ⇧+↑ or ⇧+↓), you can comment a bunch of lines in a single shot with the ⌘ + / shortcut. If the lines are already comments, the same shortcut will uncomment them.
DocC syntax — called documentation markup — is a custom variant of Markdown that adds functionality for developer documentation-specific features, like cross-symbol linking, term-definition lists, code listings, and asides.
There are two ways to add comments in Swift: // - Single Line comments. /*... */ - Multiline Comments.
Feel free to enhance this answer.
Documentation comments are just (Objective-C) comments marked as documentation. They are treated the same way as normal comments, except that you can set another color and font in Xcode. Some documentation software may even use these comments to create automatically documentation from given header files and other source code.
Documentation comment keywords are keywords that give semantical meaning to text that follows after the keyword in a documentation comment.
You can create inline documentation comments with three slashes (instead of two in normal comments), and block doc. comments with two stars instead of one (instead of one in normal comments). Example:
// Normal inline comment /// Documentation comment /* Normal block comment */ /** Documentation block comment */
You can create documentation comment keywords by specifying a keyword (one word only) after the "at" symbol. Example:
- (void)sendMessage: (id)sender; /// @description Sends the receiver. /// @available Version 1.0 through 2.2
Appledoc is a tool for creating a documentation set from your source code (including documentation comments and method signatures) and getting it to install and reload inside Xcode when needed. It's a command-line program and has instructions for how to incorporate it into your Xcode build process.
Once you have a documentation set you can add it to Xcode via Preferences > Downloads > Documentation.
The special keywords starting with an @-sign is also called HeaderDoc tags. A list of them can be found in the HeaderDoc User Guide. Please note that some of them are Objective-C and some are C++.
For those who did not watch the latest keynote: With Xcode 5 this feature will be built in. It is already available in the current developer preview (called quick help, like announced here).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With