15

In Xcode 3 it was easy to get an overview of which files are activated for current active target. I love the new feature in Xcode 4 where you can see all the targets a specific file is active for (its like an inversed view of xcode 3). Is there some mysterious way of getting that good ol' view back?

It would be really handy when specifying test-files and nibs for different targets...

Image from that good ol' list in xcode 3:

enter image description here

hfossli
  • 22,616
  • 10
  • 116
  • 130

3 Answers3

25

Expanding on tomwhipple's answer, there is a way to see all the files that are not part of a target.

Go to -> Build Phases -> Compile Sources and hit the '+' button. This will show you all the files that are not part of the target. However, this list is pretty cluttered with things that really shouldn't be in your target. But you can type ".m" in the search bar to only show the classes that aren't included.

Screenshot

Nate Petersen
  • 888
  • 8
  • 11
  • That is really powerful, you can type *.m or *.mm or *.cpp and hit cmd+a to select the lot, you can go through and de-select the wrong ones easily. Magic! – Danny Parker Nov 12 '12 at 17:11
  • @Nate Hey, please go here http://stackoverflow.com/questions/10486970/is-there-a-way-to-list-all-files-and-their-targets-in-xcode4 and post this exact answer, so that i can flag it as correct. Thanks. – Just a coder Dec 20 '12 at 19:20
19

By Target: Navigate to the project, then select the target and expand the various build phases. It's more specific because it shows you what role the file(s) play in the target.

By file: Select the file in the navigator and open the Utility pane. The targets list is shown there (but only for that one file).

Joshua Nozzi
  • 60,946
  • 14
  • 140
  • 135
  • 1
    wow! nice tip! but what it won't show is what is _not_ in the target like in the image above. I know it sounds weird, but it is in fact usefull. I think I can adjust my user-pattern to fit this tip though! – hfossli Mar 24 '11 at 22:05
  • I agree, its useful to see what is NOT a member of a target. Quite often I can add a file and forget to add it to a particular target. – Robert Jun 28 '12 at 15:42
0

I also find this lack of a checkmark list annoying. I did notice that you can add multiple files to a target via the + icon at the bottom of the compile sources list in the "by target" method.

tomwhipple
  • 2,850
  • 27
  • 28