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 .
As of Xcode 4 it seems to have changed. command - alt - shift - left arrow will do the trick...
Code folding is working now, in Xcode 9 Beta5 according to beta release note: Resolved in Xcode 9 beta 5 – IDE
Here is how:
ctrl
(control) button in keyboard and move/hover mouse cursor on any (start or end) braces. It will automatically highlight, block area.ctrl
(control) button in pressed condition and click on highlighted area. It will enable quick menu popover window with Fold
option.Fold
from menu list. It will fold your code and shows 3 dots, folding/covering entire block.ctrl
(control) button and click on 3 dots folding a block.For easy understanding, look at this snapshot:
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:
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.
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