The following code directives are often seen in the code inside the Xcode IDE:
#pragma mark-
#pragma mark Initialization
What's #pragma?
Technically, the code that starts with #pragma is a compiler directive, which is a program-or compiler-specific instruction. They do not necessarily apply to other compilers or other environments. If the compiler does not recognize the directive, it is ignored.
Role
They tell the Xcode compiler to separate the code in the methods and functions pop-up menus at the top of the Editor pane, as shown in:
Some classes, especially some controller classes, can be long, and methods and function pop-up menus facilitate code navigation. Joining the #pragma directive at this point is very effective in logically organizing your code.
Attention
- There must be no space behind the "-" #pragma mark–.
- If your logo does not appear in the pop-up menu, such as if no divider appears, on the Xcode menu "Preferences ..." The "Code sense" option in the check box uncheck "Sort list Alphabetically".
What does "iOS development" #pragma mark mean?