Best practice for sharing code between OSX and IOS app

Posted by Alberto on Stack Overflow See other posts from Stack Overflow or by Alberto
Published on 2012-09-17T07:52:15Z Indexed on 2012/09/17 9:37 UTC
Read the original article Hit count: 413

Filed under:
|
|
|
|

I am creating an iOS version of an existing OSX app and am wondering what the best practices are for sharing code between the two. The code in question only depends on the foundation framework and the Sqlite dynamic library, so it should compile and run fine on both platforms.

It seems to me there are three possible options:

  1. Create a single project with and OSX and an IOS targets, add source files to each target as appropriate.
  2. Create two separate projects for the OSX and IOS apps, put shared code in a common location in the workspace and add it as reference to both projects.
  3. Create three projects: OSX app, IOS app and a shared static library with an OSX and an IOS targets; add each library target to the respective application.

Is there any reason one of the above approaches may be better than the other two? If not, option 2 seems to be the simplest by far.

© Stack Overflow or respective owner

Related posts about ios

Related posts about xcode