Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple line comment in Xcode 8

Tags:

xcode8

I just upgraded to Xcode GM 8.0 and noticed ⌘ + / is not commenting out selected lines. Is there another command to comment out multiple lines in Xcode 8?

like image 558
DaveLass Avatar asked Sep 15 '16 19:09

DaveLass


People also ask

How do I comment multiple lines in Xcode?

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

How do I comment out lines in Xcode?

Cmd + Shift + 7 will comment the selected lines.

How do you comment multiple lines in Swift?

Multiline comments start with a forward-slash followed by an asterisk ( /* ) and end with an asterisk followed by a forward-slash ( */ ): /* This is also a comment. but is written over multiple lines.


1 Answers

In Xcode7 and earlier versions, the commenting option was available in Editor > Structure > Comment Selection. In Xcode 8 this option is disabled.

To enable these options run sudo /usr/libexec/xpccachectl and restart your Mac.

There is thread on Apple Developer Forums regarding this issue and several possible fixes. For me running the above command and restarting the Mac did the fix.

Also in Xcode 8 release note it states:

To use the Editor's Comment/Uncomment Selection and Add Documentation commands—as well as other installed Xcode Extensions—on OS X version 10.11, launch Xcode and install additional system components, then restart your Mac. (26106213)

like image 121
amiladiman Avatar answered Sep 19 '22 17:09

amiladiman