Navigate Xcode through shortcut keys!
Have you ever watched an amazing programmer *cough* Jim, Johanne *cough* live code and all of sudden they do some magical thing up on the screen, and you wonder how in the heck did they do that? For the most part, they’re coding wizards. But sometimes, and this is rare; it’s simply shortcut keys!
So let’s dive right into it. We all know the basics right.
⌘ + C — Copies highlighted text
⌘ + X — Cuts highlighted text
⌘ + V — Pastes text that was either copied or cut
And the almighty ⌘ + Z! What would we do without it! It’s all happened to us, after writing all that code and somehow you delete it all. (ʘ_ʘ)
⌘ + Z — Undo’s any of your mistakes. Yay!
How you might ask, do you delete all your code? Well, there’s a shortcut key for that too.
⌘ + A — Highlights all your text, just don’t hit any other key after you highlighted it all.
Proper indentation is key when it comes to code, and I’ve heard there’s a huge debate whether you should tab or space it but I’ll let Apple deal with it for now with this simple shortcut key.
⌃ + I — Properly indents highlighted text. Combine with ⌘ + A and it indents the entire page for you. Boom! Which by the way kinda looks like tab indentation, but who knows. ¯\_(ツ)_/¯
For those who are not sure what ⌃ is, it’s the control key. Trust me I always get that confused with this ⌥, which by the way is the option key.
There are a few more that are lifesavers so bare with me its almost over.
If you ever want to move quickly in between lines without touching your mouse, don’t fear shortcut keys are here!
⌃ + right(→) || left(←) arrow key — Let’s you jump in between words. By you, I mean your cursor.
⌘ + right(→) || left(←) arrow key — Let’s you jump to the front or back of the sentence. Again by you, I mean your cursor.
Add shift (⇧) to the top two shortcuts and it lets you highlight either the word or sentence from where your cursor is located.
Now that you know how to highlight text, I tend to find this nifty little shortcut key pretty helpful.
⌃ + ⌘ + ] || [ — Moves highlighted text up or down, like so.
Last but not least the one I frequently use which is super helpful and is a complete lifesaver, for those unfortunate enough not to have a touch bar mac (-_-). We all know that crappy little arrow on the side of a word we want to edit all in scope, but just as soon as your arrow hovers over it disappears! Making us hover over it all over again, it’s a cruel sick joke that Xcode loves to play!
Well, ladies and gents there is a shortcut key that will change your life!
⌃ + ⌘ + E
That’s it! That shortcut key will edit all in scope for you so long as the word is selected.
That’s it folks, those are some of the main shortcut keys I use when coding. I hope it helps, and now you can impress your friends and look like a wizard programmer.
Here are some helpful sites.
It ain’t easy being cheesy! :)