Making use of essential shortcuts in Xcode can speed up development and keep you in your flow. Xcode allows you to customise a lot, but most of the shortcuts are easy to adopt by default without custom settings.
Run without building
Sometimes during development, it can be useful to run the same build again, without rebuilding to quickly test the app in certain states. This can be done by combining ^ ctrl
+ ⌘ command
+ R
.
Action | Shortcut |
---|---|
Run without building | ^⌘R |
Show document items
Within classes and files, we often search for a certain method or parameter. The document items navigator is useful for quickly navigate in files. It’s even more useful when used from a shortcut, which for Xcode by default is the combination of ^ ctrl
+ 6
. As a bonus, ⌘ command
+ L
makes it possible to quickly navigate to a specific line.
Action Shortcut Show Document Items ^6 Goto line ⌘L
Jump to definition directly
Command-click no longer jumps to definition by default since Xcode 9 is introduced. It opens up a handy menu instead with a lot of options for quick editing. You can read more about this in my blog post Command-click on code options and possibilities in Xcode.
To directly jump to a definition, you can combine ^ ctrl
+ ⌘ command
+ click
.
Action Shortcut Jump to definition ^⌘Click
Combing the option key (alt) with the Assistant editor
The Assistant button splits the Xcode editor in two, with your primary work document on the left and a secondary document on the right. Quite known workflows with the assistant editor:
- Writing code on the left in combination with the Interface Builder on the right
- Writing implementations on the left and tests on the right
- Writing implementations on the left and headers on the right (with Objective-C)
When adopting the Assistant editor with programming in Xcode you will see that your speed of development improves. By adopting the usage of the option key, often labelled with “alt” on the keyboard, you can easily load new files in the Assistant editor.
⌥ option
+ Clicking a search result⌥ option
+ Clicking an open quickly result⌥ option
+ Clicking a file in the file browser⌥ option
+ Clicking “Jump to definition” in the actions menu
Basic shortcuts you should know
A list of shortcuts which you probably already use. If not, try them out and see how they can improve your workflow.
Action Shortcut Build ⌘B Run ⌘R Test ⌘U Stop ⌘. Switch between navigators ⌘(1-9) Go forward ⌃⌘→ Go back ⌃⌘← Show completions ⌃Space Clean ⇧⌘K Find in file ⌘F Find in project ⇧⌘F
Other useful less known Xcode tips
Can’t get enough of these tips and want to learn even more? Check out my blog post Useful less known Xcode tips to improve your workflow.