5

With objective-C multi-line comments could be folded. This does not appear to work with swift files. Is there a way to enable it in XCode?

Drew Rosenberg
  • 899
  • 6
  • 7
  • 1
    That doesn't seem to work yet in 6.1. I would much appreciate this feature as well. Notice that the Swift langue, the Swift standard library and the tool set are still in its infancy. You might want to file a feature request. – CouchDeveloper Oct 24 '14 at 06:00

1 Answers1

1

No.

Your best bet is to use ;{ /* Comments */ }(). This won't work anywhere but in a playground, main.swift, or inside of a function/method (Anywhere that expressions are allowed).

There's also comments: do { /* Comments */ } which can also be inlined if prefixed with ;

This will let you reliably fold / unfold inline as well as multi-line blocks.... Problems arise when you are in logic blocks though, such as if/else.. You can't put a "foldable" comment AFTER the ifs closing brace and then BEFORE the else statement:

Wont work:

if someBool == false { return } ;{/**/}()
else { print("is true!") }
    

It's ugly as hell, and a good reason to use AppCode alongside Xcode.

We're already at XC8, and it's just ridiculous at this point, alongside refactoring not available.

AppCode supports many of the missing features in Xcode, so it's a good tool to have in an adjacent space or window. You could also use VisualStudio (bootcamp/virtualbox or second computer)...

Other text editors may support this as well, (Vim, Notepad++), but I haven't used them much to know.

Community
  • 1
  • 1
Fluidity
  • 3,985
  • 1
  • 13
  • 34