I'm going to create a source code file that is meant to be used only in a development environment. Is there a way to tell Xcode to compile the file only for debug builds?
What exactly are you trying to accomplish here? Having a different code path for testing usually means you aren't actually testing what is going to be used. I would suggest using proper mocks/stubs for testing (with separate build targets and injections), or passing a debug log level or similar if you want more info.