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

As you open and view various header files, chances are you will bump into something useful, then again you’ll also find a few things that are rather interesting, such as this:

#define	__sputc(c, p) \
	(--(p)->_w < 0 ? \
		(p)->_w >= (p)->_lbfsize ? \
			(*(p)->_p = (c)), *(p)->_p != '\n' ? \
				(int)*(p)->_p++ : \
				__swbuf('\n', p) : \
			__swbuf((int)(c), p) : \
		(*(p)->_p = (c), (int)*(p)->_p++))

Open Quickly to Find Variable and Method Definitions

I’ve also found Quick Open to be helpful to quickly locate a method or variable. For instance, I was recently writing code for managing custom URL schemes. I knew there was a method to verify if a URL existed, yet all I could recall was that the method name was something to the effect of canopen. I summoned the Quick Open dialog:

Xcode Open Quickly

What I was looking for was the first entry. From there, I simply hit enter to view the method signature and I was good to go.