In a previous post, Tell Xcode Not to Compile a File, I mentioned that when a new file is imported into Xcode, if the file type is a recognized, it will be added to the Compile Sources folder. From there, Xcode will manage if/when the file needs to be recompiled based on its current time stamp.
For example, if you edit and save a file, the time stamp will be updated and Xcode will recompile the file on the next build cycle.
If you ever need to force a recompile of a file, you can do a Clean of the project (see the Build menu in Xcode). Clean will delete all intermediate files such as precompiled headers, so on the next build Xcode will recreate the current target’s precompiled header files and all other files as needed. Depending on the size of your project, this may be a time consuming process.
Should you have a need to recompile a select file or two, a better option is to touch only those specific files. For those unfamiliar with touch, this refers to a unix utility of the same name that changes file access and modification times. From within Xcode you can touch a file by right clicking on a file in the Groups and Files window and choosing Touch from the drop-down menu:
Notice there is also an Untouch option in the menu, which will mark the file state as up-to-date, thus averting a compile of that file, on the next build.