Friday, March 27, 2009

Xcode Single Window Mode

Even though it's on the first pane you see in Xcode's preferences, a lot of people don't realize that Xcode has a couple of different modes it can work in, including an "All-in-One" mode (often referred to as "single-window mode"). The original Project Builder IDE (Xcode's predecessor) used the multiple window paradigm that's familiar to long time Mac and NeXT users. To a large extent, Xcode follows that basic model in its default mode. The debugger, breakpoints, console, and compile error feedback all comes to you by way of different windows.

Now, if you're on a machine with multiple monitors, this really still is the way to go. You can put your breakpoints and console on one monitor and run your program, or the iPhone Simulator on the other, for example, so you can always see your console and breakpoints. You can move the various windows around to best use your available screen real estate.

On the other hand, if you are on a laptop, or some other single-screen setup, especially one with a smaller screen, all those windows can be a little obnoxious. Xcode's single-window mode is ideal for these scenarios.

I've been using Xcode (and before that Project Builder) long enough that I was resistant to the change. But, I'm a laptop guy. I live on my laptop, and only rarely hook up a second display. This is a habit I developed from seven years of non-stop travel. I've gotten quite efficient using just the screen on my 17" MacBook Pro and find that I don't use extra screen real estate in the form of a second monitor effectively when it's available.

Recently, I realized I wasn't as efficient as I should be, though. All those extra windows in Xcode were hard to manage, and I was using exposé constantly because I usually work with Xcode's project windows maximized to take up the full screen. So, I decided to give the all-in-one mode a chance.

I had to revert back to the default mode yesterday to take some screenshots for my current project. In less than a week, I've become not just a fan of the all-in-one mode, I'm addicted to it. I hated turning it off. I hate that I can't use all-in-one mode for writing projects.

I made a few minor changes to make single-window mode work better for me. First, I re-mapped ⌘0 (command-zero, the default project view key binding) to ⌘1 (command one), and re-mapped ⇧⌘R (the debugger window key mapping, which takes you to the other project view in single-window mode) to ⌘2. Doing that, I can easily swap back and forth between the two views with one hand. I can't remember who this tip came from - someone on Twitter - but it's a lifesaver.

I've also tweaked the toolbar a little in single-window mode. Chances are I will be tweaking more as I get more accustomed to this layout, but this is my current layout:

If you work on a single-display, it's probably worth your time to give all-in-one mode a spin for a few days.



20 comments:

hjaltij said...

I've actually used all-in-one since day one. I hated all the windows and soon found out how to change it to all-in-one. That was when my development machine was a laptop. Now when I have a real desktop with 2x23" displays I might try out the 'default' mode.

So your article actually got me interested in the opposite idea.

Thanks.
- Hjalti

Dave Mitchell said...

I started developing on a Macbook 17" and chose the all in one view since it felt more natural and similar to other IDEs like Visual Studio or Eclipse.

Definitely the way to go if your on a small screen!


In general though, I love using a laptop. Its so nice to be able to carry everything around with you, and not be tied down to a desk. Sometimes I ponder about walking down to the park and working in the sun :)

Dave DeLong said...

I have a hard time using Xcode when its NOT in AIO mode. If I have to help someone out on a class project that they're doing in Xcode, I have to change they layout style to AIO before I can find my way around things. Since my primary computer is a Macbook, AIO mode is absolutely invaluable.

Eric Busch said...

I can't believe I overlooked this. I think I'll this this out for a while. I made the toolbar the same as I had it before, but it will be nice to at least have something to try for the weekend. :)

Jeff LaMarche said...

Yeah, yeah, I know. I was slow on the uptake on this one. I've known about single-window mode for a long time. I've had several people who know I work on a laptop recommend it to me. And I've used other IDEs like Eclipse where single-window is the norm. But I didn't particularly care for those other single-window implementations, and every IDE I've ever used on a Mac, back to Lightspeed C used more than one window. I honestly just didn't expect to like Xcode's single-window mode, so never tried it out. Now get off my lawn you whippersnappers!

But seriously, getting set in your ways is a danger to be avoided as a programmer, and I did it here. Mea culpa. There's a lesson to be learned - don't stop trying new things, don't be scared to do things a different way. You might just like them once in a while.

I wanted to do this post because in our book, we assume Xcode is at the default settings for everything. I felt I owed it to those who are new to Xcode to at least let them know about this. In fact, if/when we do another revision, I will probably insert a tech block about all-in-one mode.

DadGuy said...

I suppose I'll put my opinion out there that I don' t like the all-in-one mode. I've used both extensively and had a few discussions with co-workers about it.

It's a matter of what you're doing and how you'd prefer to do it as to what works best. I used to use expose more often. Then I realized it got me into some bad habits, so I rely on it much less often and maybe mentally do some of that work instead. Hmm, I'll have to think about that. =)

I work on a 21" single monitor and I like having multiple windows open at once. Often for example when I'm working with a class or collection of functions I'll want the .h open as well as the source file open for reference. I use multiple desktops for other applications, so xcode has it's own workspace, which also is convenient.

The hotkey thing is a nice trick, that would help a lot -- I hated having my debugger and project window combined when I used the all in one view.

But yeah, I'm all over the place here... I think depending on how you code and what you're focusing on is what would make the difference on which you'd prefer on a general basis.

Jeff LaMarche said...

DadGuy:

There's no doubt it's not for everyone. We all have personal preferences, but you don't know if you like something until you try it, and I think some people don't know this is there to try.

Jeff

jozero said...

Two things bug me about the otherwise outstanding all in one view.

Primarily when I do a find it lists all the files that the found items are in, but how do I edit them without double clicking the file name and opening it in a new window? It makes it really annoying for multi file changes. is there a way to show an editor pane below the find list ?

The other item is minor. When I open the project why does it list my files on the left, then list them again in the main part of the view ? Why do I have to choose View > Zoom Editor In to single a file and start editing it?

Unless I'm missing something, both these issues prevent the view from being truly 'all in one' from the get go of opening a project

Tau Central said...

At one time Xcode had only the single-user mode, or strongly emphasized that. Then they nswitched to the multi-window setup. The battles over this in the user community, over the years, and within Developer Tools have been fierce, at times.

I think it may be more of a right-brain, left-brain thing. Some deep architecture of a person's brain seems to lead them to one or the other over time. Some people find single-window mode and think they have fallen into nirvana. Other people hate it.

Andrew said...

Jeff, plus this all-in-one mode looks much better if you do your screencasts !

RalfR said...

How do you bind Cmd-2 to Debug View. I seem to not find the appropriate menu item in the menu key bindings...

bunnyhero said...

wow i had no idea. thanks for the tip!

Jeff LaMarche said...

Tau:

That's funny. I don't remember Xcode ever being single-window by default, and I'm pretty sure Project Builder didn't even have a single-window mode. It could be that Xcode used to default to it and I just changed it without remembering it, though. Lots of things over the years that I don't remember well...

The Slick One said...

I didn't know there was a single window mode until reading this post, and decided to give it a try. For the most part, I like it, but there is one tiny little thing driving me nuts that, if I can't find a solution, will make me turn it off. I'm usually looking at 2 files at once, so I'll split the code window. .h on top, .m on bottom, or two .m files if I'm working on one that is similar to another. I'll build-n-go, launch the simulator, watch the log screen, and then go back to the code view. When I do that, the view I was working on, usually the bottom one, is not the same file as when I left. It seems to become a mirror of the view on top. What's worse, the back button doesn't seem to have any record of the file I was actually using. In some cases, I've typed a bunch of code into the wrong file before I realized what had happened. Then I have to stop and remember which file I was actually working on, and go find it. Any thoughts before I turn SWM off?

Jeff LaMarche said...

Slick One:

Sounds like a bug. File a bug report is the only thing I can offer. Even if you turn AIO mode off, you should file the bug.

Tim Mackinnon said...

With regards to customisation on a laptop - if you use the multiclutch app you can map some of the gestures to XCode shortcuts.

I use the 3 finger forward/back to go back to previous files, and the expand contract to jump between header and source files.

My said...

Thanks for the great post, you just made my day.

TJ said...

Thanks for the tip.

Edwin said...

scrub m65 kamagra attorney lawyer body scrub field jacket lovegra marijuana attorney injury lawyer

h4ns said...

What youre saying is completely true. I know that everybody must say the same thing, but I just think that you put it in a way that everyone can understand. I also love the images you put in here. They fit so well with what youre trying to say. Im sure youll reach so many people with what youve got to say.

Arsenal vs Huddersfield Town live streaming
Arsenal vs Huddersfield Town live streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Notts County vs Manchester City Live Streaming
Notts County vs Manchester City Live Streaming
Bologna vs AS Roma Live Streaming
Bologna vs AS Roma Live Streaming
Juventus vs Udinese Live Streaming
Juventus vs Udinese Live Streaming
Napoli vs Sampdoria Live Streaming
Napoli vs Sampdoria Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
AS Monaco vs Marseille Live Streaming
AS Monaco vs Marseille Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Technology News | News Today | Live Streaming TV Channels