A Few Xcode Tips

In this post I just want to share a few super useful tips & tricks I’ve learned over time with Xcode.

Shortcuts #

⌘+⇧+O #


If you don’t know ⌘+⇧+O (Command+Shift+O) then I’m really sorry because life must be hard. This is definitely the very most important shortcut in Xcode. Try it out, ⌘+⇧+O is a magical “open anything” shortcut. It summons a search bar, a little bit like CMD+Space does on Finder and allows you fuzzy-search anything in your codebase. It can find text, symbols, class names, methods, and more. Given it does fuzzy search, if you want to find a class named MySuperCrazyLongNamedViewController you can type something like MSuCrNa and it will find it.

Mash+U #

“Mash” is common language for ⌘+⌥+⌃ (Command+Option+Control). So hitting ⌘+⌥+⌃+U will run all the unit tests in the file current open.

Mash+G #

⌘+⌥+⌃+G will run again whichever was the very last unit test you ran.

⌘+⇧+? #

Do you want to do something there is no shortcut for? Use ⌘+⇧+?. This will open the help menu and set the focus on the search text field. This search is actually not constrained to help documents at all. It allows you to search for any functionality or menu item of Xcode, and lets you run it from there.

Screen Shot 2018-11-27 at 1.26.19 PM.png

Don’t Use Tabs #

This took me a very long time to find out but essentially: do not use tabs in Xcode. The implementation isn’t great and essentially each tab is a whole different instance of Xcode so it uses a lot of memory and is super slow. If you need to have multiple files open then use the side-by-side viewer.

Build Phases #


This isn’t as much a general Xcode usage tip but build phases are a way you can run custom scripts every time the app is built / run. It can allow you to do things like automatically incrementing your project’s build number, posting things to API’s, generating code and reports, etc. CocoaPods uses it to check your dependencies for example.

Schemes #


Schemes are configuration combos. They allow you to specify what happens when the app is run, built, tested, analyzed, and more, all in one config. Schemes can also be used to specify environment variables, pass arguments to the app, simulate a GPS location, change the locale / language for iOS, and more.


The idea is to be able to have many of these so you can quickly switch to the configuration you want and run or test your app using a ton of presets you’ve configured.


Now read this

Prime Numbers

Prime numbers are fun and it’s even more fun to come up with ways of finding them. People interested in prime numbers are usually interested in these areas of research: Finding algorithms and formulas that yield a lot of prime numbers... Continue →