Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode setup for joint Mac & iPhone apps that share a model

I'm working on a Core Data application. I'd like to create interfaces on both the Mac and on iPhone, with both sharing the same model code.

Is it possible to set up an Xcode project to have both OS X (x86_64 10.6) and iPhone targets? Or is there a better way to do this?

like image 749
mbauman Avatar asked Nov 21 '25 02:11

mbauman


1 Answers

You can setup a single project with both iPhone and Mac targets, but there are a lot of gotchas and somethings don't work quite right. It is sort of lame that it works so poorly.

The best way to share model code is to separate it into its own project and build it as a static library, then include that in your mac and iPhone projects as a cross project link. It is. Here is a blog post explaining how to setup code sharing between multiple iPhone projects in detail. The same technique also works for sharing the static library in a mac app.

like image 166
Louis Gerbarg Avatar answered Nov 22 '25 16:11

Louis Gerbarg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!