1. Add Documentation To Your Code
- Put cursor on name or method and press
(Cmd + Option + /) ************************* (⌘ + ⌥ + /)
2. Quick Open
- This shortcut will bring up the Open Quickly text box. You can use the text box to search by filename, method name, class name, etc. Just hit ↩ on the desired result to open its respective file on the currently active editor.
(Shift + Cmd + o) ************************* (⇧ + ⌘ + o)
3. Opening a file manually in the assistant editor
- First search for your file using (Shift + Cmd + O) and In order to open a destination file in the secondary editor with the same Assistance editor you can do it using this shortcut.
(Option + Enter) ************************* (⌥ + ↩)
4. Opening a file with selected editor
- First search for your file using (Shift + Cmd + O) and In order to open a destination file in the secondary editor with the diffrent direction Assistance editor you can do it using this shortcut.
(Shift + Option + Enter) ************************* (⇧ + ⌥ + ↩)
5. Generate memberwise initializer
- Xcode has a lesser-known refactoring feature that generates an initialization code for you: Use (⌥ + ⌘ + Click) on a class or struct > Generate Memberwise Initializer.
(Option + Cmd + Click) ************************* (⌥ + ⌘ + Click)
6. Fix next issue
- Sometimes hard to manually find the issue in the Xcode. We can simply jump to the actual error and once we jump to the error again use this command to show the error in detail.
(Ctl + Cmd + ') ************************* (⌃ + ⌘ + ')
7. Edit / Refactor All In Scope
- Refactoring is inevitable. That makes editing variables and methods in the scope a crucial tool. The following shortcut lets us edit all in scope together at the same time.
(Ctrl + Cmd + E) ************************* (⌃ + ⌘ + E)
8. Multiline Cursor
- It has happened that sometimes you need to write the same thing in different parts of the file and you are annoyed at the fact that you have to write it once and using old pattern (copy-paste) it a couple of times. Well, fret no more. You can write on multiple lines at once with this simple shortcut
(Shift + Ctrl + Click) ************************* (⇧ + ⌃ + Click)
9. Find call hierarchy
- This shortcut will open the Call Hierarchy view to show any places in your code that call the specified method, as well as any methods that call those methods in turn, and so on.
(Shift + Ctl + Cmd + H) ************************* (⇧ + ⌃ + ⌘ + H)
10. Find Selected Symbol in Workspace
- Xcode displays the declaration of the symbol in the Find navigator, along with any places where your code references the symbol.
(Shift + Ctl + Cmd + F) ************************* (⇧ + ⌃ + ⌘ + F)
11. Re-Indent Code
- The simple way to format your code. For the single line OR Multiple lines.
(Ctrl + I) ************************* (⌃ + I)
12. Lookup the view hierarchy
- To look out the view structure or the hierarchy from the Xib or Storyboard and to find out its super view which view
's we can get using this shortcut.
(Ctrl + Shift + Click) ************************* (⌃ + ⇧ + Click)
13. Open dependency in the assistant editor
- When you are working with Xib or storyboard you will require to open the view controller, In order to open a destination file in the Secondary editor with the same Assistant editor, you can use.
(Ctl + Option + Cmd + Enter) ************************* (⌃ + ⌥ + ⌘ + ↩)
14. Add and Remove Breakpoints
- Add and Remove breakpoints.
(Cmd + \) ************************* (⌘ + \)
15. Move Line / Selected text Up
- We might find ourselves doing a bit of reordering in the file. One way to do it could be doing the old and trusted cut-paste technique 😁. However, if all we want is to move the code one line up or selected text then this shortcut will help.
(Option + Cmd + [) ************************* (⌥ + ⌘ + [)
16. Move Line / Selected text Down
- We might find ourselves doing a bit of reordering in the file. One way to do it could be doing the old and trusted cut-paste technique 😁. However, if all we want is to move the code one line down or selected text then this shortcut will help.
(Option + Cmd + ]) ************************* (⌥ + ⌘ + ])
17. Search for lines of text in your files (project)
- Search your text with multi kinds of filters like Containing, Matching word, Starting with or Ending with using this shortcut.
(Cmd + Shift + F) ************************* (⌘ + ⇧ + F)
18. Find or search text with current file
- Search your text with multi kinds of filters like Containing, Matching word, Starting with or Ending with using this shortcut.
(Cmd + F) ************************* (⌘ + F) & Hit enter to jump next result
19. Find & Replace text with the current file
- Search your text with multi kinds of filters like Containing, Matching word, Starting with or Ending with, and then enter your text to replace it using this shortcut.
(Option + Cmd + F) ************************* (⌥ + ⌘ + F)
20. Jump to a Line
- Jumps to a code line using this shortcut.
(Cmd + L) ************************* (⌘ + L)
21. Show Library
- When used in the source editor, this shortcut will show a library of code Snippets (First you have to create snippets then it will bring up), image assets, and color assets. On the other hand, when used in the storyboard, it will show a library of UI objects, image assets, and color assets.
(Shift + Cmd + L) ************************* (⇧ + ⌘ + L)
22. Jump to defination
- To directly jump to a definition, you can combine
(Ctrl + Cmd + Click) ************************* (^ + ⌘ + Click)
23. Jump to file
- It opens a jump bar from where you can search the desired file and you jump directly to it.
(Ctrl + 5) ************************* (⌃ + 5)
24. Jump to Method
- It opens a jump bar from where you can search the desired method and you jump directly to it.
(Ctrl + 6) ************************* (⌃ + 6)
25. Disable/Enable all breakpoints
- When you want to enable or disable the breakpoints throughout the Xcode workspace you can do it using this shortcut.
(Cmd + Y) ************************* (⌘ + Y)
26. Search Documentation
- Put a cursor on text or select the text then jump to the apple documentation using this shortcut.
(Ctrl + Option + Cmd + /) ************************* (⌃ + ⌥ + ⌘ + /)
27. Create new tab
- It will create a new tab, simply work with the multiple tabs.
(Cmd + T) ************************* (⌘ + T)
28. Switching Tabs
- Tab is one of the most commonly used features in Xcode. Using this shortcut allows you to switch tabs from left to right.
(Ctl + Tab) ************************* (^ + ⇥)
29. Close Tab
- While working with the multiple tabs you can use this shortcut to close your current tab.
(Shift + Cmd + W) ************************* (⇧ + ⌘ + W)
30. Show hide code review
- Sometimes you might need to have a quick look on the changes you have made on your code. Use this shortcut to quickly switch to code review mode and have an overview on what you have changed, once done, just hit the shortcut again to switch back to you normal source editor mode.
(Shift + Option + Cmd + Enter) ************************* (⇧ + ⌥ + ⌘ + ↩)
31. Commit Changes
- When we are working with Git, bitbucket, or any source control tool we can directly commit over changes using this shortcut.
(Option + Cmd + C) ************************* (⌥ + ⌘ + C)
32. Reveal in Projet Navigator
- Reveal file in projet navigator using this shortcut.
(Shift + Cmd + J) ************************* (⇧ + ⌘ + J)
33. Open Preferences
- Open your Xcode preferences to easily access your apple account, set up your Xcode preference, access the derived data path, and many more using this shortcut.
(Cmd + Comma(,)) ************************* (⌘ + ,)
34. Split curent file
- When you want to split your current file within the same tab you can do using this shortcut.
(Option + Cmd + ,) ************************* (⌥ + ⌘ + ,)
35. Create a new group
- Select your folder then use the shortcut to create a group. At a time a single group will be created.
(Ctl + Option + Cmd + N) ************************* (⌃ + ⌥ + ⌘ + N)
36. Left panel (navigator) tab switch
- Switch between the different navigator from Project navigators to Report navigator using this shortcut.
(Cmd + (1-9)) ************************* (⌘ + (1-9))
37. Hide left panel (navigator)
- Hide the navigator using this shortcut.
(Cmd + 0) ************************* (⌘ + 0)
38. Right panel (inspector) tab switch
- Switch between the different navigators from File inspector to Connection inspector using this shortcut.
(Option + Cmd + (1-7)) ************************* (⌥ + ⌘ + (1-7))
39. Hide right panel (inspector)
- Hide the inspector using this shortcut.
(Option + Cmd + 0) ************************* (⌥ + ⌘ + 0)
40. Open schema selection
- When you are required to switch between the schema (Control + 0) open the scheme chooser. Select the scheme you want to run with the arrow keys and simply hit the return key to choose the schema.
(Ctl + 0) ************************* (⌃ + 0)
41. Fold methods or class
- When we have big projects or in case the file is huge with our code like extension or methods at that time we can fold code using this shortcut.
(Shift + Option + Cmd + ←) ************************* (⇧ + ⌥ + ⌘ + ←)
42. Unfold methods or class
- When we have big projects or in case the file is huge with our code like extension or methods at that time we can Unfold code using this shortcut.
(Shift + Option + Cmd + →) ************************* (⇧ + ⌥ + ⌘ + →)
43. Clean the project
- Occasionally Xcode gets frozen or something in our app becomes unresponsive or unpredictable. When that happens you first want to clean and then re-run the Xcode project which you can do using this shortcut. (FYI, You should not have to do this too often, since It will make building your app slower. It removes all the intermediary files and recreates them which takes more time to complete.)
(Command + Shift + K) ************************* (⌘ + ⇧ + K)
If you have any feedback, please reach out to me at [email protected]
#Xcode #iOS #Swift