Five Xcode Tips To Speed Up Your Development

Download Your Free Copy of
The Missing Manual
for Swift Development

The Guide I Wish I Had When I Started Out

Join 20,000+ Developers Learning About Swift Development

Download Your Free Copy

Xcode is a pretty complex piece of software and it changes with every major release. Apple's IDE (Integrated Development Environment) has dozens and dozens of tiny secrets, which you only discover the more you use it. In this episode, I share five tips that I use every day and could not do without.

1. Named Tabs

My guess is that you already use multiple tabs in Xcode. Did you know that you can assign names to tabs? Named tabs are very convenient and much easier to manage. You can name a tab by selecting it and choosing Rename Window Tab... from Xcode's Window menu.

Xcode lets you name tabs.

Whenever I work in Xcode, I have at least two named tabs, Console and Trace. As the name suggests, Console is dedicated to monitoring Xcode's output. I use Trace for stepping through breakpoints. With named tabs, I don't waste time searching for the tab I need. Xcode behaviors make named tabs even more useful.

2. Behaviors

Behaviors are another powerful feature of Xcode. With behaviors, you tell Xcode what to do when a predefined event takes place.

How often do you open the console when you are debugging an application? I have a separate window with a tab named Console, which I tell Xcode to open whenever output is generated. The possibilities are endless.

Whenever a breakpoint is hit during a debug session, Xcode automatically shows me the tab named Trace and opens the Debug Navigator. To make debugging easier, I also tell Xcode to show the debugger at the bottom of the window.

Xcode behaviors are a powerful feature that few people take advantage of.

3. Navigating Tabs & History

In Xcode, each tab has its own history. While it can be useful to click the Go Back and Go Forward buttons in the top left of the editor, it is much easier to create keyboard shortcuts or trackpad gestures for these common actions. Once you start using this feature, you find yourself using history all the time.

History repeats itself.

History has the tendency to repeat itself. Take advantage of Xcode's Go Back and Go Forward commands to save yourself time and frustration. I also use keyboard shortcuts to navigate between tabs, which makes this feature even more powerful.

4. Code Snippets

There are dozens of text snippet managers, such as Dash and TextExpander. When working with Xcode, however, I prefer Xcode's built-in code snippets. Let me show you why that is.

You create a code snippet by selecting the block of code you want to create a code snippet for and choosing Create Code Snippet from the contextual menu. Xcode's code snippets are great because of two features, availability and placeholders.

You can add multiple placeholders to a code snippet. This is great for filling in the gaps of the code snippet. By defining the availability or scope of a code snippet, you tell Xcode when it should include the code snippet in the autocompletion menu.

Xcode snippets allow you to use placeholders.

Xcode snippets allow you to specify the context in which the shortcut is displayed in the autocompletion menu.

If Xcode's code snippets are new to you, then I encourage you to give them a try.

5. Smart Breakpoints

Breakpoints are indispensable for debugging. But did you know you can assign actions to breakpoints. Each breakpoint is configurable in several ways. You can, for example, tell Xcode to ignore a breakpoint until it is hit a set number of times.

Smart Breakpoints

You can even trigger log messages or sounds whenever a breakpoint is hit. This is very useful if you don't want to pause the application every time a breakpoint is hit.

Give it a try. Select a breakpoint, right-click, and choose Edit Breakpoint.

Favorites

Xcode has been around for almost two decades and it has evolved into a powerful IDE with countless features. It pays to explore the less obvious features of Apple's IDE to speed up your development.

Download Your Free Copy of
The Missing Manual
for Swift Development

The Guide I Wish I Had When I Started Out

Join 20,000+ Developers Learning About Swift Development

Download Your Free Copy