Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code folding not working in Xcode 9.0 beta 2

I use code folding frequently in Xcode. Recently I tried code folding in Xcode 9 beta with shortcut Command + alt + left arrow and nothing happened.

So I tried to do the same with editor option in menu bar but it seems like code folding option is disabled. How can enable code folding option in Xcode 9 and make it to work again like in Xcode 8 .

Image

like image 323
Jaffer Sheriff Avatar asked Jul 11 '17 06:07

Jaffer Sheriff


People also ask

How do I minimize a function in Xcode?

As of Xcode 4 it seems to have changed. command - alt - shift - left arrow will do the trick...


2 Answers

Code folding is working now, in Xcode 9 Beta5 according to beta release note: Resolved in Xcode 9 beta 5 – IDE

Here is how:

  1. Press and hold ctrl (control) button in keyboard and move/hover mouse cursor on any (start or end) braces. It will automatically highlight, block area.
  2. Keep (hold) ctrl (control) button in pressed condition and click on highlighted area. It will enable quick menu popover window with Fold option.
  3. Select Fold from menu list. It will fold your code and shows 3 dots, folding/covering entire block.
  4. Now, to again unfold your code block, release ctrl (control) button and click on 3 dots folding a block.

For easy understanding, look at this snapshot:

enter image description here

It's all keyboard short cuts are also working.

Fold                          ⌥ ⌘ ←      option + command + left arrow
Unfold                        ⌥ ⌘ →      option + command + right arrow
Unfold All                    ⌥ U        option + U
Fold Methods & Functions      ⌥ ⌘ ↑      option + command + up arrow
Unfold Methods & Functions    ⌥ ⌘ ↓      option + command + down arrow
Fold Comment Blocks           ⌃ ⇧ ⌘ ↑    control + shift + command + up
Unfold Comment Blocks         ⌃ ⇧ ⌘ ↓    control + shift + command + down
Focus Follows Selection       ⌃ ⌥ ⌘ F    control + option + command + F
Fold All                      ⌘ ⌥ ⇧ ←    command + option + shift + left
Unfold All                 ⌘ ⌥ ⇧ →    command + option + shift + left

Here is ref snapshot:

enter image description here

like image 96
Krunal Avatar answered Sep 21 '22 09:09

Krunal


See the release notes. Code folding is not yet supported in beta 3:

The source editor in this beta version of Xcode 9.0 doesn’t support code folding. (29396003).

According to a WWDC presentation, they've done a fairly major rewrite of the editor, so don't be surprised if it takes them a while to nail all this down.

And as with all beta software, I'd suggest reviewing the release notes carefully, as there are lots of open issues that are well documented there.


Code folding now works in beta 5.

like image 41
Rob Avatar answered Sep 20 '22 09:09

Rob