Is it possible to have both an iOS app and Mac app in the same project?

给你一囗甜甜゛ 提交于 2020-01-01 08:29:07

问题


As the title says, I'm wondering if it's possible and reasonable to have both an iOS app and Mac app in the same project. That is, an Xcode project that has a Mac app target, and an iOS target.

If so, what should I watch out for, and is this even a good idea.

A little context: I'm working on a client app for a web-service, that will share a lot of the API connection (model-layer) code between the iOS and Mac platforms.


回答1:


It's quite straightforward to do this. Make sure you have the build setting "Base SDK" set appropriately for each target.

You can also add SDK-specific build settings by clicking the little (+) symbol next to a build setting:

and then you can create appropriate Xcode schemes to build everything at once.




回答2:


Yes, it is possible to have an iOS App and a Mac App under the same Xcode project.

Managing builds and settings will be easier if both Apps are in a different project.

But at the same time, it will be a lot easier to maintain and debug code, if both them are under the same project. For eg. when making changes to common API, it is faster if both apps compile under the same project to ensure that both Apps accept the common changes.



来源:https://stackoverflow.com/questions/4872541/is-it-possible-to-have-both-an-ios-app-and-mac-app-in-the-same-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!