Question

I have an Objective-C/Cocoa Mac application project for school that is supposed to have two parts: a client and a server. They have some files in common. I want to have Xcode build two applications, each with different code that runs. It currently just runs the client stuff I have set to run in the AppDelegate, but I want a separate application that will use a different AppDelegate for the server.

I know I can have two separate projects and link the files in, but is there a better way to do this?

Was it helpful?

Solution

Just create two separate .m files that each have "main" functions in them, and in the file inspector for each of those files, you can set which target (or app) you want each .m file to compile and be linked in with.

Your project would look a bit like this:

Two Mains One Project

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top