GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

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!

Hacking with Swift is sponsored by Essential Developer.

SPONSORED Transform your career with the iOS Lead Essentials. This Black Friday, unlock over 40 hours of expert training, mentorship, and community support to secure your place among the best devs. Click for early access to this limited offer and a free crash course.

Save your spot

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.

Hacking with Swift is sponsored by Essential Developer.

SPONSORED Transform your career with the iOS Lead Essentials. This Black Friday, unlock over 40 hours of expert training, mentorship, and community support to secure your place among the best devs. Click for early access to this limited offer and a free crash course.

Save your spot

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

BUY OUR BOOKS
Buy Pro Swift Buy Pro SwiftUI 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 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 Beyond Code

Was this page useful? Let us know!

Average rating: 4.8/5

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.