Alex Rivera | Logout

Does Xcode support regions?

Asked 2008-11-13T22:04:06.687
41

Does Xcode support anything akin to Visual Studio style #region directives for arbitrary code folding?

Edit
Report

1 Answer

57

No, you can only fold code on various defined scoping levels in Xcode.

You can use little tricks to make navigating via the function menu easier, though.

#pragma mark

Allows you to create a grouping where the label following mark will show up in the function menu. If the label is a hyphen, a separator is inserted into the function menu.

Also, the following labels in comments will show up in the function menu:

// MARK:
// TODO:
// FIXME:
// !!!:
// ???:

Obviously since #pragma mark is not really portable, if you're building a portable application and need it to work with a compiler that doesn't just ignore #pragma directives that it doesn't understand, the comment-style mark is a decent alternative.

answered 2008-11-13T22:12:05.063

Your Answer