Five Xcode Tips To Speed Up Your Development

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 article, I would like to 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 the tab and double-clicking its name.

Xcode lets you name tabs.

Whenever I work in Xcode, I have at least two named tabs, Console and Trace. As its name implies, 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 powerful.

2. Behaviors

Behaviors are another powerful feature of Xcode. With behaviors, you tell Xcode what to do when a particular 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. Why is that?

You create a code snippet by selecting the block of code you want to create a code snippet for and dragging it to the Code Snippet Library on the right. Xcode's code snippets are great because of two features, context and placeholders.

You can add multiple placeholders to a code snippet. This is great for filling in the gaps of the code snippet. You can also define the context in which Xcode should show a 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

What are your favorite tricks to speed up your work in Xcode. Leave them in the comments below or reach out to me on Twitter.