What is the significance of #pragma marks? Why do we need #pragma marks?

James Raitsev picture James Raitsev · Jul 28, 2011 · Viewed 99.6k times · Source

What is the purpose of #pragma marks in Xcode? Does their location in .m files matter? Should some #pragma come before all others?

  • Do they have to be present?
  • Can new marks be added? Why would they be? What causes it?
  • Is there any harm in having a mark removed? Would one ever want to?

Answer

Erre Efe picture Erre Efe · Jul 28, 2011

#pragma mark directives show up in Xcode in the menus for direct access to methods. They have no impact on the program at all.

For example, using it with Xcode 4 will make those items appear directly in the Jump Bar.

There is a special pragma mark - which creates a line.

enter image description here