Xcode - Using #pragma mark

mk12 picture mk12 · Aug 5, 2009 · Viewed 16.6k times · Source

I'm pretty sure this isn't a duplicate. Do you use #pragma mark? I've seen multiple ways, which is correct?

#pragma mark -
#pragma mark === Actions ===
#pragma mark -

#pragma mark -
#pragma mark === Actions ===

#pragma mark - === Actions ===

#pragma mark Actions

What is the way you do it? How do you suggest dividing it up? What do you normally name your sections, for say, a view controller?

Answer

Louis Gerbarg picture Louis Gerbarg · Aug 5, 2009

There is no "Correct" way, it is annotation, so how you use it is a coding style issue.

Having said that, I do:

#pragma mark -
#pragma mark Actions

Because that causes the popup menu in the Xcode editor group the title and the methods inside of the same divider.