I love using keyboard shortcuts on my Macbook! I especially love using shortcuts in Xcode because it really helps my productivity. When using keyboard shortcuts I sometimes feel like I have magic powers being able to move around Xcode with ease. Below is a list of my most commonly used shortcuts.
For reference here are the Mac symbols used for these shortcuts.
Keyboard Cheat Sheet:
⌘ – Command
⇧ – Shift
⌥ – Option/Alt
⌃ – Control
⇠⇢ – Left/Right Arrow Keys
⇡⇣ – Up/Down Arrow Keys
⏎ – Return
⇥ – Tab
⎋ – Escape
I recommend opening up a Xcode project and trying these out to see how each one works!
⌘ + R – Used for running your code
⌘ + N – Create a new file
⌘ + ⇧ + N – Create a new project
⌘ + ⌥ + 0 – Show and hide Inspector
⌘ + ⇧ + Y – Show and hide debugger console
⌘ + 0 – Show and hide Navigator
⌘ + F – Search a file for a particular thing
⌘ + ⇧ + F – Search the whole project for anything
⇧ + ⌘ + O – To open a file quickly (Great way to navigate if you know what file you are looking for)
⌘ + ⇧ + K – Cleans the folder your working in from its warnings and errors. This is useful when you’re pretty sure the code you wrote is correct, but when you run it, something is broken
⌘ + ⇧ +⌥ + K – Clean All files and build folder
⌃ + I – This will align your code and make whatever code you have highlighted look nice and clean
⌘ +⌥ + ⏎ – If you are using SwiftUI this will toggle your preview canvas
⌘ + / – Comment and uncomment code
⌘ + \ – Add a breakpoint to the current line of code
⌘ + Y – Enable or disable all breakpoints (I use this all the time when debugging code)
⌘ + . – Stop the current code that’s running
⌘ + L – Jump to a particular line in that files code
⌘ + ⇧ + L – Brings up the Library
For a more complete list of keyboard shortcuts check our Apples documentation.
I hope this helps make you a wizard of Xcode 🧙♂️! Happy programming!!