How can I make the tabs work normally on Xcode 4?

This isn't really an answer insofar as it contains a solution; I mostly just want to join in the griping. But upvoting will make you feel better and prove Apple wrong. :)

The problem with Xcode 4's implementation of tabs is that Apple has implemented them as workspace tabs. In other words, creating a new tab essentially creates a new workspace, each with its own sub-panes with their configurations, etc. It's essentially a whole environment in each tab. There are a number of problems with this choice.

This differs from most IDE/text editors' implementation of file tabs wherein a tab (generally) represents a single file, and each file has its own tab.

The problem with workspace tabs is there are only so many potential different workspaces we could benefit from, severely limiting the actual use of tabs in this way. Beyond this, the additional workspaces just become a liability, introducing more things the user of the application needs to concern him/herself with: for example, what the navigator view is, what editor mode is active (standard, assistant, version), whether the debug console is open, etc. etc. Suddenly switching to a new tab means you now have to worry about getting the environment back in the form you need it, because there's a good chance the other tab wasn't left in the state you expect to find it in. This actually discourages the use of tabs because it introduces more work in the workflow.

File tabs don't have this problem (not counting special cases like split view panes) because all that's changing is the file you're looking at, not your whole environment. Moreover, if implemented properly, file tabs work great as an immediate history, allowing one to quickly switch back to a file that was worked in recently, with little effort. The only way to do this in Xcode is to explicitly set up a new tab environment for each file you want to work with, but you have to be careful not to change the file in that tab or your file all of a sudden becomes lost: again, more work for the user.

Workspace tabs are also significantly heavier-weight than file tabs, because there is much more to remember and switching workspaces involves much more than switching files.

The truth is (and I think most will agree with me on this), to a developer, file tabs are much more useful than workspace tabs, and as it stands Xcode still lacks a proper implementation of this feature that many would consider basic required functionality in an IDE/editor.


UPDATE for 2020:

Finally, almost 10 years later, Xcode 12.x now appears to mostly resolve the issue described here. There is a new Navigation Style option in the Navigation settings panel that controls this behavior.

The behavior has some new quirks/design-choices that seem to make sense, but I'm still getting used to the new experience. For example, a tab will get re-used unless the file in that tab has been edited recently; such a tab is indicated with an italics title.


PREVIOUS ANSWER

I don't think you can currently get the behavior you desire (or I desire). While the tabs work like Safari, they don't work like tabs in other popular IDEs (Visual Studio or Eclipse). And for me this kind of sucks.

In general, I expect IDE tabs to keep more than 1 file open. So if I click a file in the project tree, I expect that it will switch to the tab I have opened with that file - if I have already opened it. Instead, XCode 4 changes the current tab to the file I clicked - making 2 tabs with the same file. Having 2 tabs with the same file is fairly useless.

This forces the user to scan the tab bar first to see if the file is currently opened; if it's not opened then you can look to the project tree. But if you click in the project tree first (which is what I tend to do) then you get punished because you will have just killed a tab.


I use a method similar to franks:

  • In Preferences > Navigation (or Preferences > General in versions of Xcode prior to 5) you can set Optional Navigation to Uses Separate Tab
  • Now opt-clicking a file in the file navigator will open it in a new tab
  • Better yet, opt-clicking links in the code opens the destination file in a new tab

The big feature missing is swapping to an already open tab containing the file if there is one (or staying in the current one).

Tags:

Xcode

Xcode4