I have a project with many different schemes. Is there a way to check if I'm building a "module scheme" or an "app scheme", without editing my build settings? Something like:
#ifdef SOME_SPECIFIC_APP_MACRO
Thanks for your help.
I have a project with many different schemes. Is there a way to check if I'm building a "module scheme" or an "app scheme", without editing my build settings? Something like:
#ifdef SOME_SPECIFIC_APP_MACRO
Thanks for your help.
Say you have the following schemes named Maintenance, Debug and Release.
Assuming you have them properly set up with custom flags in your app Build Settings > Active Compilation Conditions.
In Swift you would simply do a conditional check like so:
#if Maintenance
// ...
#elseif Debug || Release
// ...
#else
// ...
#endif
So, you do need to add a flag for your scheme in the Build Settings before using a conditional check for that specific scheme in your code. If you just look for a way to check the target though, you could easily grab that info from the plist I guess.
I don't know, may be Xcode have such defines already, but you can use this:
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) MACH_O_TYPE=BIN_TYPE_${MACH_O_TYPE} BIN_TYPE_mh_execute=1 BIN_TYPE_mh_bundle=2 BIN_TYPE_mh_object=3 BIN_TYPE_mh_dylib=4 BIN_TYPE_staticlib=5 IS_APP=MACH_O_TYPE==BIN_TYPE_mh_execute IS_NOT_APP=MACH_O_TYPE!=BIN_TYPE_mh_execute
You can put it in project build settings, or put in xcconfig and attach to project configs.
Then you can use them in conditional compilation