8 Power Xcode shortcuts every developer should know 💪
Xcode tips to boost your productivity
1. This is one i swear i can’t live without. For commenting out multiple lines of code use cmd
+ /
2. Use cmd
+ shift
+ O
to quickly search through and open any file. You can also use the same keys to navigate to any method in your code base. As a pro-tip, make sure you have the toggle swift generated interface turned on. You can click on the swift bird icon or use cmd
+ G
after the open quickly search bar appears. This allows you to search through swift generated interfaces of any Objective-C headers in your project.
3. use cmd
+ 1,2,3,4…
to easily switch between the project navigators in Xcode. Also, as a side note, cmd
+ 1
on the simulator is a shortcut to automatically shrink the current device to match its actual physical size. While cmd
+ 2
will resize it to be pixel accurate.
4. Given how much time you will be spending in the simulator, if you ever wanted to bring up the keyboard in your app, cmd
+ K
will do the trick.
5. A quick and easy way to see the scope of your functions and braces is by using cmd
+ mouse
hover over the braces.
6. Often, while doing presentations, I find this tip can be very helpful. Easily fold the scope by one level. cmd
+ alt
+ left arrow key
will fold, while the right arrow key
will unfold. Optionally, you can simply click the folded area to automatically open it.
7. Another tip i can’t simply live without is the cmd
+ click
to see the definition. This is great for when you have a large code base and you don’t really know where certain definitions of the functions live. I also find it essentially useful when i need to quickly navigate to the apple internal classes, check out the documentation and browse other methods available inside the classes.
8. Often times you find yourself navigating between multiple files in your codebase, and simply wish to go back to the previous file. Using cmd
+ ctrl
+ left
or right
arrow keys will allow you to navigate between the previous and next files that you accessed. Pretty handy me thinks.