NEW: Subscribe to Hacking with Swift+ and accelerate your learning! >>

Xcode tips and tricks – part four

Learn useful Xcode features with short videos.

Paul Hudson       @twostraws

This is part four of a series on Xcode tips and tricks, this time covering testing, debugging, colors, and more!

  1. Xcode tips and tricks – part one
  2. Xcode tips and tricks – part two
  3. Xcode tips and tricks – part three
  4. Xcode tips and tricks – part four

If you have some favorite Xcode tips of your own, let me know on Twitter!

Subscribe to Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

31. Recent files

The two Xcode shortcuts I use by far the most are Ctrl+Cmd+Left and Ctrl+Cmd+Right, which move back and forward between your recently opened files. Bonus: use Ctrl+2 or Ctrl+3 to show these files as a menu you can browse through.

32. Multiple cursors

If you hold down Option and drag over a column of text, you can make edits in multiple places at the same time. Bonus: Ctrl+Shift+Click lets you place new cursors at specific points!

33. View debugging

If you have selected a view in the view debugger, you can press Shift+Cmd+D to highlight it in the debug navigator. You can also type a class name or a view’s label into the filter box to show only matching views.

34. Timing tests

Slow unit tests make it hard to run our tests frequently. Fortunately, Xcode’s Report navigator can identify slow tests so they can be optimized or moved.

35. Detecting tests

Setting a custom environment variable in your Test scheme allows you to detect when tests are running and create test configurations at runtime.

36. Debug sounds

When working with invisible components such as network requests, you can use breakpoints to play sounds when they succeed or fail – it’s a smart way of helping you track what’s going on.

37. Quick Look

Xcode’s Quick Look system is capable of rendering previews for many data types, including attributed strings, Bézier paths, PDFs, and more.

38. Named colors

Creating named colors in your asset catalog lets you load that shared color in code using UIColor(named:), or in Interface Builder’s color selection box.

39. Refactoring storyboards

If you have one storyboard that’s grown too big, you can select view controllers inside it and choose "Refactor to Storyboard" from the Editor menu. This will pull them out into a new storyboard with references back to the old one.

40. Build settings

If you’re not sure what one of Xcode’s build settings does, just hold down Option and double-click for an explanation. Alternatively, select it and open the Quick Help inspector.

Subscribe to Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Buy Pro Swift Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift (Vapor Edition) Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Server-Side Swift (Kitura Edition) Buy Beyond Code

About the author

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 a speaker at Swift events around the world. If you're curious you can learn more here.

Was this page useful? Let us know!

Average rating: 4.8/5

Link copied to your pasteboard.