Code Folding in XCode 9

Anyone else having trouble being able to code fold Swift code in an existing project in Xcode 9? I can find a way to do it.


The Code folding ribbon is no longer an option in Preferences and all options under Editor->Code Folding are disabled. In addition, none of the old hotkeys for folding all code seems to be working.

Replies

Read the release notes. Code folding is one a long list of things that isn't implemented in the new editor yet.

You can fold code with CMD-click on func and then select fold or put the cursor on func and then CMD-ALT and left arrow to close and right arrow to open.

You can hold CMD+Shift+Click, than choose Fold, just put your mouse on begin.

Thanks..

This only seems to work with Swift Code in the latest version, NOT with Objective C Code.

I use opt+cmd+arrow left/right to fold/unfold. Works a charm.


However, there are bugs where the code will just unfold for no good reason.

Sitll in baby-shoes but working nicely. I think.


Would be great if it could 'remember' code folded across app launch !

Code Folding still does not work in 9.3 Beta 3 with C, C++ or Objective-C code. Just works with swift code. BAD !

It works (in 9.3 beta 3) for C-family code, but only for methods and classes. Folding deeper scopes only works in Swift right now.


I assume this is because Swift has a richer "language" for describing source structure, and this is yet to be retrofitted to the clang compiler. I suggest you submit a bug report to encourage Apple to do the retrofitting. (It should only take a minute to do so, since it's a known problem and you only need a brief description.)

Thank you Quincey, but code folding worked very well in xCode 8 and before with any block of code for all code that I wrote, C, C++, Objective-C. I really miss this feature so much in the new version, and I already submitted 3 bug reports about this since the first version of xCode 9. Hope this will be fixed soon.

omg, APPLE PLEASE FIX THIS, I am getting mad reading code in objective-c!!!!, it's so annoying ! read the long long code without block folding function!!!!!!!!!!!!!!!!!!!!!!!!