Xcode Tips and Tricks to Make Your Daily Work Easier

10.02.2017 | 4 min read

Xcode is still not perfect, but we all have to admit that each iteration makes a real difference. Let’s take a glimpse at what you can squeeze out from Xcode to make working with it a bit more pleasurable.

Xcode has been part of iOS developers’ lives for a few years now. Love it or hate it, but taming it to make it work the way you like certainly wouldn’t hurt. Here’s a few tips and tricks I use on a daily basis.

Keyboard Cheat Sheet

⌘ Command
⇧ Shift
⌥ Option
⌃ Control

Not so popular but useful shortcuts


⌥ Option + ⌘ Command + /

Be a good developer and leave some hints for the ones that will follow you (and probably for yourself in the future). If some part of the code is a bit more complicated than it might appear, you can leave a quick note and make things easier later on.
Go right above a symbol and press ⌥ Option + ⌘ Command + /
Based on the symbol’s structure, Xcode will generate a simple form:

Edit All In Scope:

⌘ Command + ⌃ Control + E

Code refactoring hasn’t been the biggest asset of Xcode ever since I can remember. Luckily, you have a quick way of changing the name of a function or variable in the scope of a class. Simply select the word that you would like to change and press:
⌘ Command + ⌃ Control + E.
A dotted frame will appear around selected word. Feel free to change it or fix the typo. Any update will be immediately reflected in all occurrences of a variable or function. Ta-da! It’s much safer then search and replace.

Reveal in Project Navigator

⌘ Command + ⇧ Shift + J

Have you ever found yourself wondering where the file you’re currently working on is located? A shortcut to the rescue!

⌘ Command + ⇧ Shift + J

and you will see it selected in the Project Navigator.

Open in Other Editor

⌘ Command + ⌥ Option + ,

This quick combination will open the current file in the Assistant Editor. If you are working in the Standard Editor, Xcode will switch to the Assistant Editor immediately.

Searchable menu control

⌃ Control + 6

This one’s very handy if you are working on a big class with dozens of methods. What’s really cool is that it is fully searchable. Just start typing and magic will happen.

Helpful features you might not be aware of

Git Blame

I suppose everybody has had this moment sooner or later.

You bump into a piece of crappy code and wonder: who the hell did that? Right-click on the suspicious line and choose “Show Blame for a Line”.
You might be surprised with the results…

Let’s just say I did it for the purpose of showing you an example.
If you have more than two developers in your project, you might want to bind a shortcut to this one.

Decide where to open a file

There are many ways to open a file in Xcode, but it isn’t always obvious where the code will appear.

Here are some hints on how to get the code where you want it:
– find the desired file using Open Quickly: ⌘ Command + ⇧ Shift + O
– when clicking on the desired file, hold down ⌘ Command + ⇧ Shift + ⌥ Option.
A small window will appear where you can indicate exactly where the file should be displayed.

If you like writing your code using the Assistant Editor, this one might come in handy for you:
– when clicking on a File in the Project Navigator hold the ⌥ Option key and the file will appear in the right pane. If you don’t want to use the mouse, hit Enter to open a file in the current window or hold the ⌥ Option key + Enter and the file will appear in the right pane.
The same trick works in the Open Quickly window.

Variable Breakpoints

Would you like to be informed every time a variable is modified?

Just add a breakpoint on the line where an instance is declared, and Xcode will stop (or make a sound if you like) each time the variable is changed.

If you add action to your breakpoint, Xcode can print out the current value with each update.

So, here’s my basic guide to using Xcode in a more programmer-friendly way. I hope it will make your daily grind with Xcode a bit easier and more efficient. Are there any shortcuts or hidden features you would like to share? Feel free to add them in the comments.

You may also like these posts

Start a project with 10Clouds

Hire us