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?
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 if
s closing brace and then BEFORE the else
statement:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With