#pragma mark -
This is actually an instruction to the IDE. It inserts a separator line into the navigation menu at that point, and also optional header text. It just makes it easier to find your way around a piece of code.
Example:
- @interface GCStateMachine : NSObject
- @property (nonatomic, readonly) NSSet* states;
- @property (nonatomic, readonly) GCState* currentState;
- + (GCStateMachine*) stateMachineWithStates:(NSArray*) states;
- - (instancetype) initWithStates:(NSArray*) states;
- - (void) enterState:(Class) stateClass;
- - (void) updateWithDeltaTime:(NSTimeInterval) dt;
- - (GCState*) stateForClass:(Class) stateClass;
- - (BOOL) canEnterState:(Class) stateClass;
- @end
- #pragma mark -
- @interface GCState : NSObject
- @property (nonatomic, readonly) GCStateMachine* stateMachine;
- + (GCState*) state;
- - (BOOL) isValidNextState:(Class) state;
- - (void) didEnterWithPreviousState:(GCState*) previousState;
- - (void) willExitWithNextState:(GCState*) nextState;
- - (void) updateWithDeltaTime:(NSTimeInterval) dt;
- @end
Here I declare two classes in one header file (I usually do this if the two classes are intimately bound to each other and are never used independently). The #pragma mark - between the two makes the navigation menu for this file look like this:
Note the separator line. This is the menu I use most of the time when navigating code, so it’s nice to have it laid out neatly.