Jaffer Sheriff
Jaffer Sheriff

Reputation: 1564

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

Upvotes: 5

Views: 2749

Answers (3)

John
John

Reputation: 548

In Xcode 9 build 9A235 the Code Folding does not always open the methods when clicking on the 3 dots. When this occurs you can click the method below the one you wish to open and this sometimes works. Apple should be embarassed for releasing such a half-baked feature. What's more, the boxes around the folded methods add no value and are simply additional, unnecessary, clutter.

Upvotes: 0

Krunal
Krunal

Reputation: 79656

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

Upvotes: 8

Rob
Rob

Reputation: 437552

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.

Upvotes: 5

Related Questions