Search code examples
macosiossdkcode-reuse

Sharing business logic code between iOS and Mac OS applications


I have an iOS application which I am considering porting to also run on Mac OS and sell via the Mac App Store. However I would like to have as much code re-use as possible for the business logic, so that if I fix a bug in one product I won't have to re-code everything for the other product. What is the best way to do this? With a universal iPad/iPhone app, there are simply two targets, but obviously for a Mac OS app the whole structure is different and it uses an entirely different SDK. Any suggestions? Thank you!


Solution

  • The best way to do this would be to add a Cocoa application target to your project. Go to Project>New Target and choose Cocoa>Application from the Mac OS X section. Then, with your new target selected, click the checkboxes to include the shared files.