Xcode easily add multiple files to a target

Select all the .m files in the "Project Editor" (cmd-1), show the "Utilities View" (opt-cmd-0) and click the new target in "Target Membership". Be careful not to select files that do not belong to a project such as .h files.


If the files are all in a single directory, delete the directory from the project (remove reference only), then re-add it. Xcode will ask you which targets you want the files to be added to when you re-add it.


I though't i'd return to this with an improved answer. It's still difficult to do this via Xcode main interface, as if you filter for .m and try and do CMD-A to select all, it selects the folders too, so you can't add these to the target.

However, if you go to Project Settings > Build Phases > Compile Sources. You can click the + button, filter .m files, and you can CMD-A to select all here.

This works.

screenshot

Tags:

Xcode