Xcode Shortcuts the iOS Cheat Sheet

Xcode Shortcuts the iOS Cheat Sheet



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

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 ⌘ / or Command /
  • opening the Xcode preference ⌘ , or Command ,

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.

Scheme & Destination shortcuts

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.

Breakpoint shortcut

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.

Intra file navigation

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.

Inter file navigation

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.

Editor Shortcut

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.

Xcode Editor Shortcuts

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.

Simulator Shortcuts

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 ConflictsShortcuts. 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.

Refactor Renaming shortcut adding and view in action

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.

Conflict resolving among Xcode and System shortcuts

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.

Free resources includes Xcode Shortcuts as list on a page file, on an epub and on a pdf

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

2 thoughts on “Xcode Shortcuts the iOS Cheat Sheet

Leave a Reply

Notifications for mobidevtalk! Cool ;) :( not cool