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!

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