Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to share code between multiple projects in iOS

We're planning to launch a serie of applications in AppStore. They will be for some kind of different journals, showing different contents downloaded from a server via XML. So these applications will be made from exactly the same code (It's an universal application, so It'll work both in iPhone/iPad).

My initial idea was, in order to upload the application, compile just changing the images, logos and configurations (plist) that makes the application react as a particular journal. The compressed file would be uploaded to the AppStore.

However, this has resulted a horrible method, which promotes failures and mistakes. If I forget to change some image, as you can't see them in the compiled file (as it is included) they will end up in the store (and I will need four or five days in order to get the application changed).

I'm trying to look up for a better approach, wich keep the projects as independent as possible. I would like to be able to share the entire codebase: views, classes and nibs and create different projects for every journal.

Which is the best method to achieve that?. What structure would let me group both logic (controllers, classes) and UI and use it in the different projects?.

I hope I've explained.

As always, thank you very much.

like image 222
Jacob Avatar asked Oct 22 '11 15:10

Jacob


People also ask

Can you share an Xcode project?

Xcode will push your project to your Azure Repos/TFS Git repo so you can share it with your team.

How do I open multiple Xcode projects?

If you use Command+T then afterwards you can drag that tab into the desktop space to make a new window. Then you can open your other project.


2 Answers

You should keep most of your common code as a library project. Each final project should link with this project and provide images/assets along with code to mention these assets to common code. In my day job, I write a common library too, which gets used by 2 products/apps at my employer.

like image 102
Aditya Kumar Pandey Avatar answered Oct 20 '22 17:10

Aditya Kumar Pandey


An Xcode project can have multiple Targets, all the Targets sharing code, but each Target getting its own resources (icons, images, text, plists, etc.) from a different subdirectory/folder within the same project directory/folder. Then you can check the whole thing, or just the shared source, into your source control repository.

You should also be testing each of your apps, built exactly the same way as any submission except for the codesigning, on a device before uploading to the store.

like image 21
hotpaw2 Avatar answered Oct 20 '22 16:10

hotpaw2