How to handle multiple targets in Xcode using a shortcut language?

I created two targets in Xcode, but I use swift. Can anyone learn how to handle multiple goals using quick? As we did in Objective-C, as shown in the following example.

#if defined(TARGET_LITE)

      NSLog("Lite version");

 #else

      NSLog("Original version");

 #endif

Thank you in advance

+4
source share
2 answers

You could use preprocessor instructions like #ifin Swift, but I think you need to define the target variables yourself. I use it as follows:

Build Settings → Fast Compiler Symbols → Other Quick Flags Set a variable -D LITEin your Lite-target configuration

In your code, you can use it as follows:

#if LITE
   // do something
#else
  // do something else
#endif
+4

" " "" -D TARGET_LITE Swift Compiler - > :

enter image description here

, , ( , ):

enter image description here

+3

Source: https://habr.com/ru/post/1613947/


All Articles