Earl Grey
Earl Grey

Reputation: 7466

Xcode two projects - one for business logic, another for UI?

Is what I am suggesting in the tittle possible?

The main goal is to completely separate the business logic (to be reused in other lightly rebranded apps) and the custom UI for a particular client.

That means, I would have the same core, but on top of it would be very small view controllers driving customised UIs.

I understand that I can have a workspace containing two projects...But should they be peers? OR should one project consume/include the other one? There is no need for app delegate for UI code. It is already in the business logic project. How should i organise my projects structure so that the latter is able to use the first with business logic?

Upvotes: 1

Views: 445

Answers (2)

Clement Prem
Clement Prem

Reputation: 3119

The better design would be, having the business logic in a static library inside your main project. It is not a good idea to mix UI code in a business logic target. You can add Bundle to your static library to hold resource files such as plists & etc.

I used this approach in one of an enterprise app project. So far so good. We can simply scale, extend & modify the business logic without affecting the presentation logic.

Upvotes: 0

Sandro Machado
Sandro Machado

Reputation: 10205

You can use different targets: https://developer.apple.com/library/ios/featuredarticles/XcodeConcepts/Concept-Targets.html

In the same project you can separate the different implementations (assets, xbis...) using the targets. You can also specify different pre-processor flags for each target and use #ifdef

Upvotes: 1

Related Questions