Can you set code regions in Xcode?

You can also use:

// MARK: -

or

// MARK: Initialization

which is more portable than #pragma mark.


Using Xcode editor, you can collapse or expand any block of code by clicking in the little left margin. Moreover, you can put a mark in any point in the code with:

#pragma mark your title as long as you want

Your mark will then appear in the middle popup menu on top of the editor window.


Update: I have found that a duplicate of this question exists here. The answers may be of interest.


Sorry for being pedantic but it's "Xcode", not "X-Code".

You can for example go:

#pragma mark -

or

#pragma mark Initialization

This will give you this kind of thing:

alt text