简体   繁体   中英

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?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM