Xcode expand/collapse braces/brackets {} side bar missing

3.7k views Asked by At

The side bar, next to the code line numbers, that allows expansion/collapsing of brace/brackets {} is no longer showing in Xcode. I am trying to figure out how to get it back.

3

There are 3 answers

0
SAHM On BEST ANSWER

Go to Xcode Preferences/Text Editing and check the "Code Folding Ribbon" box.

EDIT: As of Version 9.0.1 (9A1004), this feature has been removed from Xcode 9. I am looking for a new editor because I use this feature so much, and I cannot believe they actually removed it in Xcode 9.

3
Krunal On

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 (command) button in keyboard and move/hover mouse cursor on any (start or end) braces. It will automatically highlight, block area.
  2. Keep (hold) (command) 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 (command) 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

Here is ref snapshot:

enter image description here

0
AbdullahCoder On

Run the following with your cursor on the curly braces:

To fold: ⌥ ⌘ ← Option + Command + Left Arrow

To unfold: ⌥ ⌘ → Option + Command + Right Arrow