Multi-line comments in Xcode

Is there a way to comment various lines at the same time in Xcode IDE? Selecting which lines to comment, then clicking somewhere et voilá.. the /* ... */ characters wrapping the code.

Thank you.


Command + Shift + 7

or

Command + /

This inserts // in front of every selected line.


Xcode Version 6.1

Shortcuts:

To Comment: Select the code to be comment, ⌘ + /

To uncomment: Select the code an press ⌘ + /

Also see taskbar Editor>Structure "(un)Comment Selection" as user 2137640 pointed out.


The answer is actually very simple if you want to comment a continuous sequence of lines. Select the consecutive lines, then simply press ⌘ /.

I have no idea how to comment multiple non-consecutive lines. Maybe somebody else can help with this, if it is even possible (I doubt it.)


There is such a function in the menu. Try: Edit->Insert Text Macro->C->Comment Section. It will create a (multi-line) comment around the currently selected text.

However, using the menu is probably often slower than manually inserting the comments. But, you can also bind a key to the menu item via the preferences key binding settings.


For single line Comment use ⌘+/
For multiline Comment you need to install CComent plugin

to install plugin manager use alcatraz