Multi-line comments in Xcode

Is there a way to comment on different lines at once in the Xcode IDE? Choose which lines to comment on, then click somewhere et voilรก .. / * ... * / characters that wrap the code.

Thank.

+65
xcode
Oct 03 '09 at 9:58
source share
10 answers

Command + Shift + 7

or

Command + /

Inserts // before each selected line.

+127
Oct 03 '09 at 10:24
source share

Xcode Version 6.1

Shortcuts:

In the comment: select a code for comments, โŒ˜ + /

To uncomment: select a code, press โŒ˜ + /

Also see the task bar "Editor"> "Structure" (un) "Select Comment", as indicated by user 2137640.

+8
Nov 05 '14 at 21:29
source share

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

I have no idea how to comment on several lines that are not related to each other. Maybe someone can help with this, if possible (I doubt it).

+5
May 20 '12 at 23:14
source share

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

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

+4
Oct 03 '09 at 10:15
source share

For a single line, use the comment โŒ˜ + /
For multi-line comment you need to install CComent plugin

use alcatraz to install plugin manager

+4
Sep 05 '14 at 7:52
source share

Got! You must back out of the lines so that the comments are the first character in the line, not a tab or space, and then by pressing CMD + /. Just tried it in Xcode 5.1.1, it works like a charm.

0
Jun 08 '14 at 17:13
source share

It worked!

Draw the desired lines, then press Command + /

The same rule applies to uncommentation.

0
Jun 20 '15 at 20:32
source share

in Xcode 7.x

Shortcuts:

In the comment: select a code for comments, โŒ˜ + /

To uncomment: select a code, press โŒ˜ + /

0
Jul 16 '16 at 21:20
source share

For xcode 8 โ†’
sudo / usr / libexec / xpccachectl
restart the computer.

0
Oct 07 '16 at 15:51
source share

Xcode 11 now supports multiple multi-line comments (shortcut unavailable). Just enter / * to start multi-line comments.

enter image description here

Hope this helps you.

0
Jun 13 '19 at 12:50
source share



All Articles