This is part one of a series on Xcode tips and tricks, this time covering faster testing, generating, interfaces, identifying constraints, and more!
Xcode is a fantastic tool, but it’s so big it can be hard to keep track of all the things it can do. To help resolve that situation, below you can find a selection of Xcode tips and tricks that you might find useful. If you have some favorite Xcode tips of your own, let me know on Twitter!
Xcode lets you search through your project using regular expressions. To try it out, go to the Find navigator, click Text, then choose Regular Expression. Now you can search and replace code using whatever regex you like.
When using TDD you can work more quickly by running a subset of tests – press ⌃⌥⌘G to re-run only your last test, or ⌘-click several tests to run only them.
When using IB in the assistant editor, change Automatic to Preview then change the language from English to Double-Length Pseudolanguage. This will cause every word in your UI to be repeated, letting you make sure it all fits.
If you’re in a folder that has both a workspace and a project, use “xed .” to open the workspace in Xcode. If there were only a project, that would have been opened instead.
If you're looking at a Swift data type and just want a summary of what it does, press ⌃⌘↑ to have Xcode generate an interface showing only its external properties and methods.
If you find Xcode's jump bar a little long, try filtering it. After pressing ⌃6 to bring up the jump bar, you can start typing a few letters to filter all your properties and methods using a fuzzy search.
If you’ve been using Xcode for a few years, you should run “xcrun simctl delete unavailable” to remove any old simulators that are no longer supported. It's common to save 20-60GB with that one command!
When your program is paused, right-click on a variable and choose Watch. The next time that variable changes, you can step back one frame to see where it happened.
It’s common to see lots of output in Xcode’s log when you have an Auto Layout problem, but if you add identifiers to your constraint you’ll get more helpful messages – easy to do in both Interface Builder and code!
If you've ever wondered how long it takes for Xcode to build your project, you can find out with one Terminal command.
SPONSOR Tired of wasting time debugging your Swift app? Instabug’s SDK is here to help you minimize your debugging time by providing you with complete device details, network logs, and reproduction steps with every bug report. All data is attached automatically. It only takes a line of code to setup. Get started for free.
Paul Hudson is the creator of Hacking with Swift, the most comprehensive series of Swift books in the world. He's also the editor of Swift Developer News, the maintainer of the Swift Knowledge Base, and Mario Kart world champion. OK, so that last part isn't true. If you're curious you can learn more here.