Install Multiple Versions Of Xcode: Updated for Xcode 5 and Greater

Much has been written about managing multiple versions of Xcode. With the release of the Mac App Store, Apple changed the Xcode install process. It’s time to revisit this discussion, including installation of older Xcode versions as well as some tips on managing beta releases.

Prior to the Mac App Store, it was quite simple to work with multiple versions of Xcode, as each release had an option to specify the destination folder during install. No more, installations (non-beta) will overwrite an installed version of an app with the latest release, as each new release is installed in the /Applications folder with the name Xcode.app.

In this post I’ll walk through how I prefer to manage multiple versions of Xcode. If you have another approach, please post a comment.

Continue reading

Change Variables On The Fly While Debugging With XCode and LLDB

Somewhere around Xcode 4.3 lldb became the default debugger. I’ve been spending some time learning how lldb differs from gdb and stumbled upon a trick to allow changing the value of a variable while in a breakpoint.

For example, in the code below I print the value of testStr, I then change its value using the expr command in lldb, I then print the value of the string again:

1
2
3
4
5
6
7
NSString *testStr = @"fubar";
NSLog(@"testStr before: %@", testStr);
 
// Set breakpoint here, run the 'expr' shown below
 
// Show testStr again
NSLog(@"testStr after: %@", testStr);

Continue reading

Xcode Drag and Drop Tricks

You can easily drag/drop a block of code in Xcode by simply marking a block, click and drag. If you look closely, within the editor window there will be vertical bar in the leftmost column that shows the insertion point.

In addition to dragging code about inside the code editor, this is also a quick way to add code to the snippet library. Simply mark, click, drag and drop a block of code onto the snippet library pane (lower right corner of the screen). Obviously, the Utilities view needs to be visible before this maneuver.

How to Find Xcode Matching Brace, Bracket or Parenthesis

This tip I stumbled upon while in Xcode and I inadvertently double clicked on a brace and the matching brace and code sandwiched between was highlighted. Intrigued, I tried the same with parenthesis and brackets and it worked as anticipated.

Should there be no match, Xcode responds with a beep. It couldn’t be easier to find matching code delimiters in Xcode.

As an example, here is a line of code with a handful of parenthesis:

UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0

Continue reading

Xcode ‘Open Quickly’ Tips and Tricks

You may be familiar with the Xcode Open Quickly option, which provides a shortcut to open a file in your project via Shift-Command-O and entering a file name. This is often much quicker than searching through the Project Navigator to find a file.

How to View System Header Files

Good news is, you can also use the same process to view header system files. As an example, bring up the Quick Open dialog and enter stdio – as you type a series of matches will be shown:

Xcode Open Quickly

Continue reading