Xcode 8 Adding Block Comments

I was hoping the new release of XCode 8 would have the ability to select multiple lines of code and with either a menu choice or two-finger tap allow the user to select N-Lines of code and turn them into comments (along with the ability to invert that operation). Other code editors do this nicely and it is an easy way to turn entire blocks of code into comments............ok, we can still use the old /* <block of code */ comment out in Swift-3 and XCode-8 but it would be nice to do this with code selection and menu clicks.


Thanks

Accepted Answer

As far as I know, Xcode does not include the ability to generate /* */ comments, but it can generate // comments. Just hold Command and press the forward slash key. If you really want to auto-generate /* */ comments, I would recommend that you use Automator to create a text service that's visible to Xcode. If you want an example of how to do that, I'd be happy to explain in more detail.

Actually, your suggestion does exactly what I want if you highlight multiple lines of code and then type "Command /".


Thanks!

Glad to help! 😉

Except Command-slash no longer works in Xcode 8 for me. Only me?

Which beta build are you using? For a previous one (not the current beta 6—8S201h), I couldn't get ⌘/ to work either.

Was able to fix it by this https://forums.developer.apple.com/message/159283#159283 I use beta 6 or whatever is the latest.

Xcode 8 Adding Block Comments
 
 
Q