Seven Xcode Tricks Every Developer Should Know
To be productive and efficient, you need to know your tools. For a Cocoa developer, that means mastering Xcode. While Xcode is a complex piece of software with a steep learning curve, the tricks listed in this tutorial should significantly boost your productivity.
1. Open Quickly
The Open Quickly command can be found in Xcode's File menu. However, the keyboard shortcut, Command + Shift + O is much more convenient. The command brings up a modal for browsing files, classes, methods, and functions.
It saves me a lot of time each and every day. If Open Quickly is new to you, then I strongly recommend giving it a try. You can thank me later.
2. Reveal in Project Navigator
The Reveal in Project Navigator command is a true timesaver for large, complex projects with lots of files and folders. The command shows or reveals the current file in the Project Navigator on the left. The default key binding is Command + Shift + J.
3. Assistant Editor
You are probably already familiar with Xcode's Assistant Editor, a superb addition to Apple's popular IDE. Most developers leave the Assistant Editor underused, though. It is great for showing the counterpart of a file or for simultaneously working on the user interface and implementation of a view controller.
The Assistant Editor has a lot more uses, though. I use it often to find out where or how often a particular method is invoked. Place your cursor in the body of a method and select Callers from the Assistant Editor's menu at the top.
4. Jump to Method
When I am working in a class or structure, I often have the need to quickly jump to a particular method in the class. This is very easy by pressing Control + 6 and typing the first few letters of the method's name.
5. Browse Documentation
No matter how experienced you are, the documentation is a developer's best friend. To quickly open Xcode's documentation browser and search for a particular class or method, press Option and click the symbol you are interested in.
Even though Xcode's documentation browser has improved over the years, Dash is my preferred documentation browser. It is faster and more powerful than Xcode's built-in documentation browser. To make the above trick work with Dash, you need to install the Xcode plugin for Dash.
6. Edit All in Scope
Multiple cursors are great and every modern editor should include this feature. Xcode's code editor also includes this feature, but it is difficult to find and hard to use. In Xcode, the feature is better known as Edit All in Scope.
Hover with the cursor over a symbol and wait a second or two until a little triangle appears on the right. Click the triangle and choose Edit All in Scope from the menu. Do yourself a favor and create a key binding for this command.
7. Git Blame
Do you work in a team? Have you ever felt the need or the urge to know who added that horrible bug? Place your cursor on the offending line, right-click to open the contextual menu, and choose Show Blame for Line. Oops. Did you add that line?
What are your favorite tricks to speed up your work in Xcode. Leave them in the comments below or reach out to me on Twitter.