As iOS programmers, we live and breathe and have our being within Xcode, so it makes sense to be as familiar as possible with its capabilities, and to take advantage of whatever innovations allow us to get work done. But, ironically, as a new version of Xcode is released, exactly when noteworthy new features are most likely to be arriving, it’s easy in the heat of the moment to overlook them.
So let me save you a little time. Here are a couple of small observations about Xcode 12 that could make a difference to my own work habits, and possibly to yours as well. Interestingly, they both have to do with panes in the project window.
At the left and right of the project window, as you surely know, are the Navigator pane and the Inspectors pane, respectively. The Inspectors pane used to be called the Utilities pane; it has been renamed in this release.
If you’re like me, you probably feel the need to reclaim some screen real estate from time to time by hiding those panes. And again, if you’re like me, you’ve probably memorized the keyboard shortcuts that toggle their visibility — Command-0 (zero) for the Navigator pane, Command-Option-0 for the Inspectors pane.
Sometimes, however, you don’t want to take your hand off the mouse. Or perhaps you’re just not a keyboard shortcut kind of person. Well, there are also toolbar buttons for showing and hiding these panes. However, counterintuitively, up to now both buttons have been located at the right end of the toolbar. New in Xcode 12, the button for the left pane, the Navigator pane, is at the left end of the toolbar, and the button for the right pane, the Inspectors pane, is at the right end of the toolbar. What a concept! (One wonders how much discussion had to happen at Apple in order to implement this rather obvious improvement.)
Now here’s something that’s not so obvious. New in Xcode 12, when you’re displaying a project window in fullscreen mode, if one of these panes is hidden, you can show it temporarily in slideover mode by hovering the mouse at that side of the window. I think that’s a really great little idea. Fullscreen mode can be an important way to get all the screen real estate you’re entitled to, and this feature might make it even more inviting.
The big new idea in the Xcode 12 interface, in my opinion, is document tabs. This innovation means that a project window can display two different sorts of tab: document tabs and window tabs. That can be rather confusing, because menu commands don’t always distinguish between the two types. But document tabs are really neat, so they are worth knowing about.
First, let’s remind ourselves about window tabs. A window tab is what Xcode 11 and before calls simply a tab. It displays the whole project window interface, and can display it differently from another window tab. Thus one window tab might show the Project navigator, while another might have the Project navigator hidden, or display a different navigator. In other words, a window tab is like a second window on the same project, except that it doesn’t occupy any independent screen real estate: rather, it shares the space with an existing project window.
To make a new window tab in Xcode 12, choose File > New > Window Tab (Command-T), revealing the window’s tab bar (just below the toolbar) if it wasn’t showing already.
Okay, on to document tabs. Let me set the scene. You’re probably aware that Xcode 11 introduced the ability to subdivide an editor pane into subpanes. That’s cool, and allows you to work in two places at once. But it comes with a cost: you’ve divided your screen real estate in half for each document you display simultaneously.
Well, a document tab is an alternative way of populating an editor pane with multiple documents. With document tabs, instead of dividing the editor pane into two or more smaller panes, the editor pane displays different files as different tabs that you see one at a time, occupying the entire editor pane — but you can readily switch between them.
To make a document tab, Control-click on a file listing in the Project navigator and choose Open In Tab. You might not see anything change at that moment, but the result is that this file is now “pinned” as a tab in the editor pane: what I mean by “pinned” is that if you click a different file listing in the Project navigator, it opens as a separate tab rather than replacing this “pinned” file. Thus, “pinned” files have a degree of permanence. They mean: These are the particular files I want to work on right now. (Tabs that open without being pinned are replaceable; they display their file names in italics.)
You can “pin” as many files as you like, thus making it easy to switch between them and ensure that none of them will be replaced accidentally. If the document tab bar is showing, you can actually drag file listings right into it to “pin” them as tabs! To show the document tab bar all the time, choose View > Always Show Tab Bar so that it is checked.
Now, I don’t know about you, but I am very often working on some limited set of files at once, like two or three. And unless I’m trying to draw an outlet or action connection between a storyboard and code, I don’t actually need to see the content of those files simultaneously. So my guess is that I could end up using this feature a lot. Time will tell, but I’ll certainly experiment with it whenever an opportunity arises.
Learn more about Xcode 12: Improvements in Testing