I’ve updated Xcode yesterday from version 6.4 to 7, and lo and behold, I couldn’t find those little triangles anymore that used to let me fold and unfold my code. You know, the ones that let you collapse a method so that code becomes more readable I really don’t like it when a simple upgrade punches me in the face like that.
Turns out that the Xcode upgrade had disabled this setting under Preferences – Text Editing. See the option that reads “Code Folding Ribbon”? It was un-checked after the upgrade, removing the little triangles from the gutter (where you set break points). Enabling it brings our code folding back (see screenshot above).
There are other methods of collapsing code of course: to collapse all methods, hit SHIFT + OPTION + CMD + LEFT CURSOR. Likewise, to open all methods, use SHIFT + OPTION + CMD + RIGHT CURSOR.
To open a single method, you can also click those little three dots in the yellow brackets.
And finally of course, we can use the menu as before. Head over to Editor – Code Folding for all these options and their respective keyboard shortcuts.