[21 November 2020]: This article has been updated for Xcode 12.
When doing development using Xcode, the most common actions performed by developers are updating code, switching tabs, changing source editors and opening files. Therefore, able to perform all these navigation within Xcode with a simple editor or storyboard shortcut will definitely give your productivity a significant boost!
In this article, let’s look at the top 10 most useful Xcode shortcuts for navigation that every developer should know.
Knowing the Mac Keyboard Symbols
Sometimes the Mac keyboard symbols are a bit confusing. The following diagram should be able to clear things up for anyone who has difficulties in recognising the Mac keyboard symbols.
With all that said, let’s get started!
Show / Hide Minimap 👉 ⌃⇧⌘M
control + shift + command + M
Minimap is one of the most anticipated features introduced in Xcode 11. It is a bird’s eye view of your code and it is meant for navigation.
By using minimap, you can easily and accurately navigate to any parts of your source code. Therefore, able to show / hide the minimap easily can definitely improve your productivity.
Show Library 👉 ⇧⌘L
shift + command + L
When used in source editor, this shortcut will shows library of code snippets, image assets and color assets. On the other hand, when used in storyboard, it will shows library of UI objects, image assets and color assets.
I mostly use this shortcut in storyboard to quickly bring up the UI objects library and add the desired UI object into storyboard.
Show Document Items 👉 ⌃6
control + 6
This shortcut is especially powerful when you want to navigate through a long source code.
What you can do is to use this shortcut to bring up a list of document items, start typing to filter the list, then select your desired document item to jump to the respective source code location.
Quick Open 👉 ⇧⌘O
shift + command + O
This is my favorite and most used shortcut of all time.
This shortcut will bring up the Open Quickly text box. You can use the text box to search by filename, method name, class name, etc. Just hit ↩ on the desired result to open its respective file on current active editor.
Pro tip: Use ⌥↩ to open the Open Quickly text box result in another new editor.
Highlight File in Project Navigator 👉 ⇧⌘J
shift + command + J
I usually use this shortcut along side with the quick open shortcut (⇧⌘O).
The trick is to use the quick open shortcut to search for the desired file, open it in the editor, after that hit ⇧⌘J to quickly highlight the file in the project navigator. Note that this shortcut also works on the secondary source editor.
Go to Line 👉 ⌘L
command + L
During a code review session, you fellow colleagues might need you to improve or rework on a specific line of code. In this kind of situation, this shortcut can help you quickly navigate to the exact line of code that you need to rework.
Switching Tabs 👉 ^⇥
control + tab
Tab is one of the most commonly used features in Xcode. Using this shortcut allows you to switch tabs from left to right.
Pro tip: Use ^⇧⇥ to switch tabs from right to left.
Show / Hide Preview 👉 ⌥⌘↩
option + command + enter
I found this shortcut extremely useful when working on a SwiftUI file. Hitting this shortcut enables you to have a quick UI preview of your current SwiftUI code. Furthermore, you can also use this shortcut when working on storyboard.
Show / Hide Assistant 👉 ⌃⌥⌘↩
control + option + command + enter
Back in those days where I am still using Objective-C for iOS development, I always use this shortcut to open the assistant editor so that I can work on both .m and .h file side by side.
Nowadays, I mainly use it alongside with storyboard especially when I want to make an IBOutlet
connection to the source code, or do a quick updates on my source code while working on storyboard.
Show / Hide Code Review 👉 ⌥⇧⌘↩
option + shift + command + enter
Sometimes you might need to have a quick look on the changes you have made on your code. Use this shortcut to quickly switch to code review mode and have an overview on what you have changed, once done, just hit the shortcut again to switch back to you normal source editor mode.
Bonus Shortcuts
The fact that Apple has repositioned the navigator, inspector, and debug area show/hide button in Xcode 12 (which I am not a big fan of because my mouse pointer will have to travel much further in order to hide all 3 areas) makes me use the following shortcuts much more often.
Wrapping Up
To be able to use all these shortcuts proficiently might seem a bit overwhelming at first. However, once you started using them on your day-to-day development work, you should be able to master them in no time.
Just remember, practice makes perfect. 👍
Further Reading
- 5 Must-Know Xcode Shortcuts for Unit Testing
- Re-enabling the iOS Simulator Slow Animations Shortcut
- Useful Less Known Xcode Tips to Improve Your Workflow
I hope this article gives you a very good idea on how you can improve your productivity by using these 10 amazing shortcuts.
What is your favorite Xcode shortcut? Let me know in the comment section below. If you like this article, feel free to share it.
You can follow me on Twitter for more article related to iOS development.
Thanks for reading. 🧑🏻💻
👋🏻 Hey!
While you’re still here, why not check out some of my favorite Mac tools on Setapp? They will definitely help improve your day-to-day productivity. Additionally, doing so will also help support my work.
- ✨ Bartender: Superpower your menu bar and take full control over your menu bar items.
- ✨ CleanShot X: The best screen capture app I’ve ever used.
- ✨ PixelSnap: Measure on-screen elements with ease and precision.
- ✨ iStat Menus: Track CPU, GPU, sensors, and more, all in one convenient tool.