Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-line comments in Xcode

Tags:

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.

like image 904
BigJoke Avatar asked Oct 03 '09 09:10

BigJoke


People also ask

How do I comment multiple lines in Xcode?

By selecting a few lines of code (pressing ⇧+↑ or ⇧+↓), you can comment a bunch of lines in a single shot with the ⌘ + / shortcut.

How do you insert multiple lines in comments?

Multi-line comments start with /* and end with */ . Any text between /* and */ will be ignored by JavaScript.


2 Answers

Command + Shift + 7

or

Command + /

This inserts // in front of every selected line.

like image 198
Georg Schölly Avatar answered Sep 22 '22 22:09

Georg Schölly


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.

like image 44
Carl Avatar answered Sep 19 '22 22:09

Carl