Same code base for iPhone/Desktop app

前端 未结 2 733
迷失自我
迷失自我 2020-12-28 22:24

I have an iPhone/iPad app that I want to port to MacOSX. Most of my objective C classes should work just fine as long as they do not contain UIKit stuff. Obviously the inter

相关标签:
2条回答
  • 2020-12-28 23:15

    You can also simply add the files from one project as references to the other one. Simply drag them from the source project (where the actual files reside) into the other project. The dialog will ask you whether you want to copy the files. Choose no. This will make the second project point to the files in the first project. Edits go into both projects.

    Be careful with this, though, as there are a few differences between APIs in iOS and MacOS, even if they are called the same.

    0 讨论(0)
  • 2020-12-28 23:19

    I've had difficulty setting up a unified project with different targets for the two OS types, so I generally split this into two projects that share source files.

    For an application that will be targeted Mac and iOS, I tend to create one directory for the application. I place the two projects within this, and set up one directory for shared source files, one for iOS-specific stuff, and a third for Mac-specific stuff. This way, you might have different projects, but shared files will update between them as they are changed. The only time you manually have to sync the two is when a new shared file is added to the application and must be added to both projects independently.

    You should be able to restructure your existing project to support this without much trouble.

    0 讨论(0)
提交回复
热议问题