DevJuice: Three useful Xcode tricks
Some Xcode challenges seem to crop up repeatedly. Today, I thought I'd share a few solutions that you might find helpful to integrate into your workflow.
Challenge: When you move an Xcode project to a new folder, all your file references die.
Solution: Avoid those red "can't find" file references by changing the way each group defines its location. If you're pulling in a suite of code from another folder, select it and open the File inspector (View > Utilities > Show File Inspector). Choose "Absolute Path" from the Path pop-up.
Now, when you move the folder, those files remain fixed to the original location. You won't "lose" them in the update.
Challenge: Your project is jam-packed with groups and subgroups and you want to find a file in your project.
Solution: Start with File > Open Quickly (Command-Shift-O). Enter enough text to locate the file name you're looking for.
Once you find the right name, for example "BezierFunctions.m", select the name and click Open. The file now appears in the workspace editor.
Right-click within the editor and choose Reveal in Project Navigator from the contextual pop-up. Presto, Xcode finds that file for you, opens its parent group or groups, enabling you to manage the file and within its group setting.
Challenge: You're using a function or type and want to quickly reference the original declaration.
Solution: Move your mouse to the item in-code, and Command-click. Xcode immediately jumps to the original definition file.
Alternatively, press the Option key. The cursor switches to "?" and a dashed highlight appears under the item name. Click to reveal a pop-up menu. Choices on this menu vary, depending on whether the selected item is custom or system supplied.
In this screenshot's example, you can click on BaseGeometry.h to open the file that declared the POINT_IS_NULL macro, providing an equivalent result to command-clicking.
The option-click trick also offers more info in addition to the move-to-declaration option, particularly for system-supplied items. Yes, you can jump directly to the CGPath.h header file using this little trick, but you can also read a description summary or hop to the class reference document.
Subscribe to Newsletter
Software Updatesmore updates
- Dropbox adds file/folder renaming and Office document editing to iOS app
- Vizzywig 8xHD price tag now a very affordable $49.99
- Automatic targets teen drivers with License+ service
- Dropbox adds support for TouchID
- YouTube for iOS gets updated with full support for iPhone 6 and 6 Plus
- iOS 8.0.1 update now available (Updated -- Don't update!)