Fold code for functions you don’t mutate

Something I’ve found very helpful for my busy mind is to fold the code within functions I’ll rarely mutate. Folding/Unfolding code is as easy as tapping option-command-leftarrow to fold and option-command-rightarrow to unfold.

So take the following code:

NewImage

Place the cursor anywhere within the function brackets and tap option-command-leftarrow, and this is what you have:

NewImage

One heck of a lot cleaner, and easy to unfold by either clicking the ellipsis or tapping option-command-rightarrow. Encourage your developers to use this practice – once comfortable with it, you’ll save time.

Of course — do not forget the code folding options from the editor menu to be able to fold or unfold entire files.

Leave a Reply