swift #if
2019-07-31 本文已影响0人
yxibng
参考:https://stackoverflow.com/questions/45484715/swift-multiple-targets-handling-macros-not-working
For Xcode 8 and above, use Active Compilation Conditions setting in Build settings / Swift compiler - Custom flags.
This is the new build setting for passing conditional compilation flags to the Swift compiler. Simply add flags like this: GOLD, SILVER etc. without -D etc. Then check it with compilation conditions like this:
#if GOLD
//
#elseif SILVER
//
#else
//
#endif
image.png