WWDC23 SALE: Save 50% on all my Swift books and bundles! >>

Xcode tips and tricks – part three

Learn useful Xcode features with short videos.

Paul Hudson       @twostraws

This is part three of a series on Xcode tips and tricks, this time covering vector artwork, sorting your project, code coverage, 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!

Save 50% in my WWDC23 sale.

SAVE 50% To celebrate WWDC23, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

21. Enhanced testing

Use parallel testing to make Xcode run multiple tests simultaneously to save time, and use random order testing to make Xcode run tests in a different order each time – a simple way to stop you making one test dependent on another.

22. Adding documentation

Documentation comments are shown inside Xcode’s Quick Help, its code completion, and other places. To add one, press ⌥⌘/ then type in the comment you want to use.

23. Locking views

If you’ve used Interface Builder to design a view exactly how you want it, set its Lock option to All Properties to avoid accidental changes in the future.

24. Vector artwork

If you add PDFs to your asset catalog, you can ask Xcode to embed the vector data into your app bundle so your images can be drawn at any size at runtime.

25. Customizing behaviors

You can customize the layout Xcode adopts when debugging – make it show the paused code in a new tab, show or hide variables, show or hide inspectors, and more. Best of all, closing that tab puts you back to the previous layout!

26. Project sorting

Xcode can help keep your project organized by sorting any group by either name or type. Sorting by type also sorts by name, so try that one first.

27. Indenting code

If you’ve moved some code around and messed up your indenting a little, select the code and press Ctrl+I to have Xcode fix it.

28. Jumping to a line

Xcode’s Open Quickly shortcut can take you straight to a specific line number in your file – type part of your filename, then a colon, then the line number you want to jump to.

29. Code coverage

If you ask Xcode to gather code coverage information, it will tell you exactly which parts of your app’s code were executed by your tests.

30. Adding constraints

You can add multiple Auto Layout constraints in Interface Builder by holding down Shift as you’re clicking.

Save 50% in my WWDC23 sale.

SAVE 50% To celebrate WWDC23, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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: 5.0/5

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.