Auto generate method comment in Xcode

Is there a way in Xcode to generate method comment automatically similar to what you do in Eclipse for javadoc comments.

For example press you may hit /** one row before a method declaration and eclipse automatically generates the skeleton of method comments.


  • You can use the Code Snippets library for this. It won't automatically generate placeholders for each parameter, but it's pretty useful nonetheless. Here's what you do:

    1. Write out a sample comment block in your code somewhere.
    2. Insert <#xyz#> where you want a placeholder named 'xyz' to appear. (These are like parameter completion placeholders, so you can tab between them and overwrite them.)

    For example:

     * Method name: <#name#>
     * Description: <#description#>
     * Parameters: <#parameters#>
    1. Open up the right hand sidebar. In the bottom pane click on the two curly braces icon to bring up the snippets library.
    2. Select and drag your text to the code snippets library.
    3. It'll create a new one. Double click on it, click edit in the popup, and give it a completion shortcut (e.g. comblk for comment block.)

    Now, when you type 'comblk' anywhere in your editors, the autocomplete popup appears and you can hit return to paste in the snippet. The first placeholder will be selected and you can start typing the method's name. Hit tab to switch to description, and so on.

    Not ideal but it's better than nothing. Snippets are a nice idea that Apple haven't quite finished implementing yet.