About
This is the M Cubed Software weblog. To find out more about us head to our about page.
Search
Feed
Archives
- June 2010
- April 2010
- March 2010
- February 2010
- January 2010
- November 2009
- August 2009
- July 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
Making Xcode’s Source List Work For You
Posted on 03/08/2009 at 11:28 PM in Coding
One of the first things you'll see when you open a new project in Xcode is this:

This is the default Xcode source list and to be frank, it is one of the biggest pile of donkey droppings Apple has created. One table is used to manage files, built targets for each bundle, access executables for changing sessions and also get access to compiler errors, searches, project bookmarks, version control, breakpoints etc. Needless to say it is a frustrating and annoying experience.
The problem is, this has been solved in the condensed layout mode, with the items split up into 3 different tabs. File management is done in the Files tab, target related stuff in the Targets tab and all the other guff is thrown into the Other tab. Apple obviously acknowledges that these need to be separate, but only provides an obvious way to do it in one of Xcode's 3 layout modes. For any project with a lot of files you need to do a lot of scrolling to get to other sections.
The key word there is "obvious". I discovered yesterday that there is a way to make the Xcode source list suck a hell of a lot less. I've known for a while that you can split the source list vertically, but what I didn't realise is that each split view can have different items in it. This opens up the source list to be a much more flexible tool.
With this new discovery I have been able to add all the bits I care about to different split views and delete all the other stuff I don't care about. I've never really used anything other than the project, targets and executables sections. The others generally can be accessed from elsewhere in the UI, but in an All-in-one layout the breakpoints group can be useful as it prevents the breakpoints UI from popping up in a separate window.
So now my source list looks like the one below (though less condensed as I'm not trying to take screenshots of it most of the time). The top files section takes up most of the space as that is where I spend most of the time. I've moved the NIBs smart group into a section of its own so I can always have access to my NIB files no matter what the state of my file tree is, and I've got the 3 other important sections at the bottom, which I can move up as and when I need to access them:

But how do you show and hide these various sections? Well the quickest and easiest way is to just select an item and hit backspace to delete it. The other way is to right click on an item, select the preferences menu item and select the item from the list to remove. Unfortunately this is a little buggy so do not combine the two methods. The menus don't want to link up to the correct split view which can cause a lot of frustration after deleting by hitting backspace. As always, I've filed a bug which you can read on Open Radar.
It would help to get Apple to fix this (hopefully for Xcode 3.2) if others were to file bugs referencing this and show it is affecting a lot of people. The fact that the menus are so buggy with this shows that this probably isn't a well known tip, I've used Xcode for nearly 5 years and only just found this, but hopefully it helps you with making Xcode's source list much more useful.
(3) Comments
Comments
I’m a big fan of reworking the Xcode file layout too, my only complaint is that it’s project specific so you have to set it up for each new project. Not too much of a pain if you’re only working on one project for a long time, but it would be nice to have a preference that allows you to setup a default config.
Posted by Michael Fey on 04/08/2009 at 08:48 PM
You can define a default that will be picked up by projects. You can drop in a default.pbxuser without any other <username>.pbxuser in the project bundle and it will define the defaults for that project. These will get sucked into and saved out with a user specific .pbxuser once you open the project.
Consider checking in your project bundle with an project.pbxproj and default.pbxuser so that when you pull down the project from source control on a new system or user account your project with get much of what you desire automatically.
Also you can put a default.pbxuser into a project template so newly created project get one by default IIRC.
Posted by Shawn on 05/08/2009 at 09:58 AM
To set up the default view for new projects:
1) Configure your project layout.
2) Make your project window active
3) Choose Window > Defaults…
4) Click “Make Layout Default”
If you mess it up, repeat clicking on “Reset to Factory Default”
Enjoy,