How to use Targets in Xcode

Targets are an extremely yet totally undocumented feature of Xcode. They allow you to write code once, and then build multiple “versions” of the same code base. This makes maintenance and code updates extremely easy across more than “product”.

I use those quotation marks because usually an “Xcode Project” equals a “Product” (such as one iPhone app, or one Mac app). But really it’s the Target that defines the product, and it is feasible to write code once and use it to create several “product versions” of your app, for example:

  • a Lite and a Pro version
  • an iPad and an iPhone version
  • an iPad/iPhone version and a Mac version
  • different apps altogether based on the same code family

Targets are extremely easy to use, let’s see how in Xcode 4.6:

This content is for members only.

That’s all I know about Targets – have fun!

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

2 thoughts on “How to use Targets in Xcode

  1. Thanks, just the info I was looking for! But I found there’s an easier way to add a new target and share resources. Just right-click your existing target, and choose “duplicate”!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.