On our Xcode Snippets talk, we introduce the term Sloths Speed Coder. None of us want to be a slow boring coder. We can choose, not be a Sloths Speed Coder. We said the first step is to start using Code Snippets and today we gonna talk about the second step. Shortcuts, Xcode Shortcuts. A craftsman always knows his tool. He knows how to use it. In order to be a better craftsman on iOS we also need to put some special care on Xcode Shortcuts, the iOS Cheat Sheet. Why the iOS Cheat Sheet? Well there is no shortcut on success, but there are always some boost on the path of learning. The Xcode Shortcuts are similarly the boost for iOS learning. Suddenly you act like a pro. It is kind of a cheat sheet for achieving the next pro batch from the starter.
Well if you use some other cool stuff like AppCode, then this blog post may not add value to your craftsmanship. Otherwise let us dive deep đ.
Another very useful shortcut for me is the slowing down the Simulator’s animation. By toggling the animation I can see the transformation in a far more greater details. There are also some shortcuts for scaling the simulator. These various Simulator Shortcuts are also the topic of this blog post.
At the end of this blog we can have the Xcode and Simulator shortcuts in different format to make life a lot easier.
Background
- Build & Run Shortcuts
- Playground
- Scheme & Destination based Shortcuts
- Breakpoint
- Intra File Navigation
- Inter File Navigation
- Editor shortcuts
- Moving Focus to different editor
- Find & Replace
- Tab & Window selection
- Simulator Shortcuts
- Adding shortcuts on Xcode
- Adding Refactor Renaming shortcuts
- Xcode Shortcuts Conflict resolving
- How to use this blog post
- Give me my free Xcode shortcut resources
- Reference
Before we start we have to understand that the number of Xcode shortcuts are not short at all. There are thousands of shortcuts people use regularly. On this blog post I will share mine.
Some very obvious & popular shortcuts like
- toggling comment
â /
orCommand /
- opening the Xcode preference
â ,
orCommand ,
will not be discussed here. Because either shortcuts like toggle comment is very well known or shortcuts like opening the Xcode preference is not regularly used.
We can watch the various Xcode & Simulator shortcuts in action on our youtube playlist.
Build & Run Shortcuts
I believe we all use those shortcuts.
Build for Running | â B | Command B |
Build for Testing | â ⧠U | Command Shift U |
Clean Build Folder | â ⧠K | Command Shift K |
Run | â R | Command R |
Stop running app | â . | Command . |
Run All Test | â U | Command U |
Playground
There are two useful playground shortcuts. Specially after you disable the auto run option.
Run | ⤠R | Control R *customized |
Stop | ⤠. | Control . *customized |
This two shortcuts are customized by me. It is my preference. You can add your based on your preference. Later on this blog post we have Adding shortcuts on Xcode section, visit the section for more details on adding shortcuts on Xcode.
Scheme & Destination based Shortcuts
Now this Xcode shortcuts are not very common among us. But once you start to using those I am sure you can’t stop using these shortcuts.
Multiple scheme is a requirements now a days. We usually have two to three scheme like staging, production and release. All of those target individual endpoints for data fetching plus the other configuration setup. To support localization you also may have one or two schema. So now that you have multiple scheme how would you like them to run? Each time by clicking the schema from the list by a mouse or trackpad?
And what about the device or simulator selection? Agin will you use the mouse or trackpad?
Oh come on there is a far more better way than this. Let start using the shortcuts for Xcode Scheme and destination selection.
Next Scheme | â ⤠] | Command Control ] |
Previous Scheme | â ⤠[ | Command Control [ |
Scheme selection list | ⤠0 | Control 0 |
Next Destination | â ⤠âĨ ] | Command Control Option ] |
Previous Destination | â ⤠âĨ [ | Command Control Option [ |
Destination selection list | ⤠⧠0 | Control Shift 0 |
Let us have look on the Schema & Destination based shortcuts in action.
Breakpoint
There are many of the breakpoints. But the most used are as following.
Add/Remove Breakpoint | â \ | Command \ |
Activate/Deactivate Break Point | â Y | Command Y |
Let’s see those in action.
Intra File Navigation
Now this one is a bit huge. It is far more faster movement once you have the mastery on the intra file or in file navigation.
Start of line | â â | Command Left Arrow |
End of line | â â | Command Right Arrow |
Go to Line number | â L | Command L Then type the line number |
Start of Word | âĨ â | Option Left Arrow |
End of Word | âĨ â | Option Right Arrow |
Forward camelCase | ⤠â | Control Right Arrow *customized |
Backward camelCase | ⤠â | Control Left Arrow *customized |
Scroll up | ⤠â | Control Up Arrow *customized |
Scroll down | ⤠â | Control Down Arrow *customized |
Start of file | â â | Command Up Arrow |
End of file | â â | Command Down Arrow |
Quick access on properties and methods [Show Document items] | ⤠6 | Then write down the property/method name |
Let us watch the Intra file navigation in action.
Inter File Navigation
Now let us have a look on the inter file navigation.
Opening a file | â ⧠O | Command Shift O |
Previous Opened file | â ⤠â | Command Control Left |
Latest Opened file | â ⤠â | Command Control Right |
Related items like siblings, protocol, super/sub class etc. | ⤠1 | Control 1 |
Selecting Project | ⤠4 | Control 4 |
Selection among group | ⤠5 | Control 5 |
Toggling between Interface & Implementation | â ⤠â â ⤠â | Command Control Up Command Control Down |
In action.
Editor shortcuts
The editor shortcuts as follows.
Showing Standard editor | â âŠī¸ | Command Return |
Opening Assistant editor | â âĨ âŠī¸ | Command Option Return |
Reseting Assistant editor | â âĨ ⧠Z | Command Option Shift Z |
Opening Version editor | â âĨ ⧠âŠī¸ | Command Option Shift Return |
Debug area toggling | â ⧠Y | Command Shift Y |
In action.
Moving Focus to different editor
Suppose we have some editors open. But clicking is no doubt a time consuming task. So let us introduce ourself with editor focusing in Xcode.
Move focus to editor | â J | Command J |
In action.
Find & Replace
Find is one of the most common used shortcuts. The Find and Replace was a very useful one before Xcode’s refactoring was available đ. Also the Refactoring in current scope and all through the project are also super useful shortcuts.
Find in file | â F | Command F |
Find in project | â ⧠F | Command Shift F |
Find & Replace in file | â âĨ F | Command Option F |
Find & Replace in project | â âĨ ⤠F | Command Option Control F |
Edit all in scope, in current file | â ⤠E | Command Control E |
Refactor, Renaming in all files | â âĨ ⤠E | Command Option Control E *customized |
Navigation filtering | â ⧠J | Command Shift J |
Tab & Window selection
Selection between different tab and window selection shortcuts as follows.
Open the current file in new tab | â T | Command T |
Next Tab | ⤠âĨ | Command Tab |
Previous Tab | ⤠⧠âĨ | Command Shift Tab |
Selection between two Xcode window | â ~ | Command ~ [tilde sign] |
Simulator Shortcuts
We not only have the Xcode Shortcuts only but we also some simulator shortcuts. which definitely add more value on the iOS day to day Cheat Sheet. Let us have some simulator shortcuts.
Now we can say the Xcode and Simulator Shortcut Cheat Sheet
Rotate simulator | â â â â | Command left Command right |
Home screen | â ⧠H | Command Shift H |
Recent Apps | â ⧠H | Command Shift H Quickly press H two times without releasing â and ⧠|
Toggling In Call status bar | â Y | Command Y |
Toggle keyboard visibility | â ⧠K | Command Shift K |
Screen shot | â S | Command S |
Toggle animation | â T | Command T |
Actual Size | â 1 | Command 1 |
Point accurate Size | â 2 | Command 2 |
Pixel accurate Size | â 3 | Command 3 |
Let us watch the simulator shortcuts on action.
Adding shortcuts on Xcode
Move to Xcode -> Preferences... -> Key Bindings
. Here you can add or update the Xcode shortcuts. The Customized
section have all the customize shortcuts that we previously defined. Also best not to have any Conflicts
Shortcuts. On the next section we will watch to add a custom shortcut and man that’s an important one. It’s none other than the Renaming shortcut scoped on the whole project đ.
Adding Refactor Renaming shortcuts
The refactoring to rename
a property, is given a separated section on this blog post because of the importance it has on our daily use. Xcode took some time to revel the Swift refactoring. But still it is one of the most use feature. Currently we do not have a default shortcut for Renaming a property. So let us add that shortcut and watch it on action. Let us have a better understanding through a video.
Xcode Shortcuts Conflict resolving
Now as we start to add some shortcuts as by our preference, Xcode will start to notify us if we make some conflicting shortcuts. However those shortcuts may not only be conflicting with already defined Xcode shortcuts, but also with System shortcuts.
Anyway the solution is simple. We need to remove one of the conflicting shortcut. On Xcode press the command ,
â ,
to open the Xcode preference. Go to Key Bindings
. Then select the Conflicts
section. Now you will have the conflicting shortcuts list. The Red
marker are conflicting shortcuts with-ing Xcode. And the Yellow
are the conflicting shortcuts with the system.
For inter Xcode shortcut conflict just select the one that you want to remove. Tap/click on the -
negative sign to remove that shortcut. Simple right.
On the other hand for conflicting shortcuts with system shortcut we need to remove those from System Preference
. Open the System Preference
, tap/click on the Keyboard
and select the Shortcuts
section. Now just deselect those which are conflict with Xcode. We need to remember that those system shortcuts now will not be active after we deselect those. So cut your coat according you needs. Let see the System level conflict resolving in action.
How to use this blog post
There are couple of ways to use this blog post as your benefit. The very first and easy way is to bookmark this page, which I not gonna recommended. Because this blog post may not be something you need to visit on some timely manner.
There is another way, a better way. I can send you the related docs which includes a pdf and a Page Document and an epub formatted book.
Now you can use the pdf as reference by printing or keeping somewhere from where you can access more quickly.
Better way is to add the epub book on your Books.app
application and use it as the reference for finding the Shortcuts of Xcode and Simulator.
The best way I believe, will also need your effort. You can pick the specific shortcut table and make it a pdf or an image and can keep it as your wallpaper on your working space. Once you become expert on that shortcut, then move to the next table of shortcuts and follow the same way until you become also an expert on that part also. Continue until you think you are good enough. On the mean time you can also add your preferred shortcuts on the way.
When I started to use Xcode and Simulator shortcuts, I didn’t have this resources. I believe it is a very good resource to have. Now you can have it. Use the Xcode Shortcuts resource as a Cheat Sheet for iOS development to boost ur level.
Give me my free Xcode shortcut resources
I will need your email id for sending the resources. I can confirm I don’t like unnecessary emails on my mail box, so I confirm I won’t send anything unnecessary.
If you already filled the email, you can still have the resources again. Just fill the email and continue to confirm section. On the confirming section you will have the download link. Never mind to submit your email more than once to get those resources. Though you will get the resource on your mail once, after that you need to download it form the mail confirmation section.
Welcome to Xcode Shortcuts paradigm, the iOS dev Cheat Sheet.
End talk
The Xcode Shortcuts is one of the coolest Cheat Sheet we can have on our disposal. Let us deposit those Xcode Shortcuts more often so that it makes a boost on our iOS career, you know this is the Cheat Sheet. See you around.
Reference
- Xcode & Simulator shortcuts playlist on youtube
- More on NSHipster about some cool gesture use
- Initial inspired from swifteducation
2 thoughts on “Xcode Shortcuts the iOS Cheat Sheet”