Search code examples
xcodeswiftxcode6xcode7-beta5xcode7-beta6

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


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.


Solution

  • 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.