1

Is there a quick way to fold and unfold a block of comments in xcode 7?

While I'm trying out new code I like to keep different versions of a "solution" until I decide which one is my favorite and delete the rejected material.

remedy
  • 377
  • 3
  • 10
  • 1
    possible duplicate of [How can I fold blocks of comments in Swift using Xcode the way I do it in Visual Studio?](http://stackoverflow.com/questions/32573269/how-can-i-fold-blocks-of-comments-in-swift-using-xcode-the-way-i-do-it-in-visual) – Eric Aya Sep 15 '15 at 09:50

2 Answers2

5

The ability to Fold & Unfold code blocks is set to OFF within Xcode 7.

Steps to change this:

  1. Select Xcode (top left)
  2. Choose Preferences
  3. Navigate to Text Editing (center)
  4. Tick the option Code folding ribbon

Once you've done this, you'll be able to collapse the comments, along with blocks of code.

I hope this helps!

.

Added Picture Reference

enter image description here

Community
  • 1
  • 1
ChrisHaze
  • 2,800
  • 16
  • 20
1

Code-folding block comments does not work in Xcode 7 - 7.2.1 in Swift files.

You can, however, hack it by using an empty closure to surround the comments. This will also work with multiple line comments too.

_ = { /* Comment
      myCommented.code
      */ }

Definitely a hack, but could save you lots of scrolling around.

Daniel Asher
  • 1,493
  • 1
  • 16
  • 21