Active Compilation Condition

Hi

 

I have a Universal Swift Framework built in Xcode 10 Swift 4.2 and I want to display some messages depending on Active Compilation Condition flags that are provided by the app.  For example a struct in the Framework contains the following:

public struct Person
{
  public let name: String
  public let age: Int
  
  public init(from decoder: Decoder) throws
  {
    #if LOG
      NSLog("Log A")
    #else
      NSLog("No Log")
    #endif
 
    ...
  }
}

In the app that has the Framework embeded, I would set LOG in the Active Compilation Condition for Debug (Any Architecture).  So when the app is running in either simulator or on the actual device and the person struct is initialized, I would see “Log A” appear in the Console or Debug area (in Xcode).

 

I haven’t been able to get this to work, “No Log” appears.  Have I misunderstood the prupose of using Active Compilation Conditon

 

Appreciate any help.

 

Thanks

Powered by WPeMatico

About

You may also like...

Comments are closed.