Adding an iOS Version to a Mac App

I searched for an answer for a while and have not yet found an answer. I already have a Mac application as an Xcode project, and it works great. Now I want to make an iOS application version. What would you recommend as the best way to do this? There are several Cocoa classes that will be shared between the two versions, as well as some resource files (images, lines). It seems the best way to do this is to have two separate Xcode projects and add them as subprojects, but I can't figure out what is wrong.

Thanks for any help.

PS I am using Xcode 4.x

+4
source share
3 answers

So what I did in the end, which seems to work, is simply to have two completely separate projects and store the shared files in some kind of folder on my computer. Then add the shared files to each project and do not select the option "Copy items to destination folder". That way, I can edit the files in one project, and the changes will appear in another project.

0
source

It looks like you want to add a second goal to your project. See the screenshot "2 goals, multiple platforms"

enter image description here

At the bottom of the project page, you will see the " Add Target " button (displayed in the screenshot). This will allow you to create a new goal for your project. Both will be available for compilation and launch separately, but they will exchange files.

Alternatively, you can use a workspace with two or three projects. enter image description here

One project for each purpose, and possibly one to host common classes. This requires adding common classes to each project. Just drag the container from the project to the other two projects to link the classes.

+7
source

I'm not sure how to do this .. but if you see this project - https://github.com/mattgallagher/AudioStreamer

It has iOS and mac projects in one directory, which you can open in either an iOS project or a mac project, they also use the same class for streaming audio ...

I check it in more detail and publish it if I find something ...

Change 1 -

Here are some articles you may find useful -
http://www.cocos2d-iphone.org/forum/topic/12397

Same code base for iPhone / Desktop application

I usually create a Mac project in a different directory and then copy its files to the folder with the iOS project. You can share all the sources, probably even pch, but I prefer to use one pch for mac and one for iOS. Move Info.plist from Mac and rename it to Info-Mac.plist and change it to MYPPROJECTNAME-Mac.xcodeproj

Pretty simple, but you add any files to the project - you need to add them again in Mac.xcodeproj. There probably should be a way to have Mac and iOS in one xcodeproj, but I couldn't do it in Xcode3, so I use two xcodeprojs.

0
source

Source: https://habr.com/ru/post/1386805/


All Articles