iphone - iOS project setup: several apps slightly different between them. Several targets -


i have iphone app , asked create new products (apps) use main code of app apart adding new features. not paid/lite version, want more 2 versions. it's politic app , new products same app new menu option big events (one app big event, 1 different event, , on). apart this, different apps (included original , base one) need work ipad.

it not content changes, code change also. different menu, , new option different event depending on app. app works tabcontroller 4 options. first 3 same in applications, 4th 1 gives access specific event, different content , logic.

the theme (mainly colors) of apps different.

so reading , got solution reuse big part of code setting different targets , using macros execute 1 or section depending on target. lead dirty code full of "if-else". there solution, or kind of design-pattern better this?

any appreciated.

javier.

use multiple targets in xcode can suit needs well, can create multiple targets in xcode right clicking on existing 1 in project setting , duplicate.

then should add different compiler flag in duplicated target in order tell them apart in code. click new target , rename whatever want, go build settings , search apple llvm compiler 4.2 - preprocessing, lets second target named targetb, preprocessor macros targetb=1.

in code can use #ifdef write different code different target.

#ifdef targetb  //do target b #else  //do else #endif 

not can use different code in different target, can use different resources files too, go build phases in each target , check out copy bunle resources.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -