XCODE TIPS & TRICKS
presented by TOWER › Version control with Git - made easy
1. DECIDE WHERE TO OPEN A FILE
4. TABS
In Xcode, you can open a file in various ways: in the standard
Tabs are well-known from almost every IDE and text editor.
editor, in a new or existing assistant editor, in a new or existing
However, three things make tabs in Xcode especially powerful:
tab, or in a new window. Here’s how you can decide about this:
a) Each tab can be configured individually. For example, one tab
⌥
⇧
— When clicking on a file in the Navigator, hold down
could contain just two editor panes, while another one could
contain the project navigator, a single editor pane, and the
— When clicking on a symbol in an editor pane, hold down
utilities area. You can therefore configure tabs that are
⌘
⌥
⇧
optimized for different use cases (like coding, debugging,
A pop-over will appear and let you choose where exactly you
interface builder tasks, etc).
want the file to be displayed.
b) Tabs persist in a workspace. When reopening a project,
Xcode restores its tabs — including their unique structure.
2. OPEN QUICKLY
This makes it worthwhile to take some time to configure
your “perfect” setup.
You shouldn’t waste your time digging for a file in your folder
hierarchy. Instead, you can use Xcode’s “Open Quickly” dialog by
c) By double-clicking a tab, you can assign it a name. Named
⌘
⇧
pressing
O
. Simply start typing any part of a file’s
tabs can then be used in “Behaviors” (see #5).
name — it doesn’t even have to be consecutive letters: “mwinco”
will find your ”MainWindowController” class.
5. BEHAVIORS
As if that wouldn‘t be cool enough, this dialog also lets you
With “Behaviors”, you can tell Xcode how to react when certain
⌘
⌥
⇧
decide where exactly to open the file: hold down
events happen. For example, you could have the console view
while double-clicking the file to bring up the pop-over from #1.
shown whenever your app starts running, or you could have a
new tab opened whenever you start a search.
3. CUSTOM CODE SNIPPETS
This becomes even more powerful when combined with named
Whenever you find yourself typing the same bits of code mul-
tabs. For example, whenever your app pauses, you can have
tiple times, you should create a code snippet. To do that, first
Xcode open your named tab “Debug” — a tab that you configu-
make sure that the “Code Snippet Library” pane is displayed
red exactly how you want it to look (maybe with an assistant
⌘
⌥
⌃
by pressing
2
.
editor and the debugger shown, but the project navigator
hidden).
Now go back to your editor pane and start typing what will soon
be a custom snippet — and remember to insert placeholders for
Behaviors can be configured in Xcode’s preferences window.
values you have to fill out when invoking it (e.g. “<#token#>”).
KEYBOARD SYMBOLS
Then highlight and drag that code to the library pane. Apart
from naming it, you should also define a “Completion Shortcut”:
⌘
⌥
Command key
Option (alt) key
when you type these letters later, Xcode will offer to substitute
⌃
⇧
Control key
Shift key
them with your custom snippet.
VERSION CONTROL
Go beyond Xcode‘s basic version control support and combine it with Tower — the most powerful Git client for Mac. Try it free for 30 days.
30-day free trial available at
Version control with Git - made easy