5

As mentioned elsewhere, #pragmas inside methods don't work in Xcode 4.

What's a good way to do quick navigation to different sections within a long method, for example to specific cases of a switch statement?

(I try to keep methods clean & short where practical, but that's a topic for elsewhere.)

Community
  • 1
  • 1
DenverCoder9
  • 3,635
  • 3
  • 31
  • 57

1 Answers1

4

Not sure if this is exactly what you are looking for... What I like to do is to simply use code blocks like so:

// some code

{
     // some code that should stay together
} // [a comment that explains what the code does]

This at least allows you to use Xcode's code folding: When you fold in the block between the two { }, you get {...} // [your explanatory comment]

It is also great to limit the scope of variables and can (very) slightly improve memory efficiency.

mrueg
  • 8,185
  • 4
  • 44
  • 66