How I arrange windows in Xcode

A coding tip from Mike Morton, by way of Mark Dalrymple, inspired me to post a micro-tip of my own.

Often I need to spend some time working on a subsystem of classes. Typically the classes have a natural logical ordering: the main class is A, which uses abstract class B, which has concrete classes C and D, and so forth. I open these classes in their own windows and arrange them like this, with class A in the top left corner of my screen:

| A        |
|  +----------+
|  | B        |
|  |  +----------+
|  |  | C        |
|  |  |  +----------+
+--|  |  |  D       |
   |  |  |          |
   +--|  |          |
      |  |          |
      +--|          |
         |          |

I find this makes it easy to jump from class to class. The lower-left corners are always visible and they're big click targets. I like using my spatial memory to connect the position of the windows with their place in the conceptual scheme of things. This ordering also makes me feel reassured that what I'm looking at is logical and finite.

Here are some handy mouse and keyboard tips that go along with this:

  • Command-Option-O opens a file in its own window.
  • Command-Option-UpArrow toggles a window between the .h and the .m.
  • Command-DoubleClick on a class or protocol name opens its source file.
  • Command-0 (that's the number zero) brings you back to the main project window.

I briefly tried using the favorites bar in the main Xcode window (View -> Layout -> Show Favorites Bar), but never warmed to it, maybe because it's only in the main project window, which often has windows in front of it. I might give the favorites bar another chance someday.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.