Swift Journey Log

Using Preprocessor Macros:

func println(object: Any) {
    #if DEBUG
        Swift.println(object)
    #endif
}

And just set “DEBUG” as a custom flag for the Swift compiler (Build Settings –> Swift Compiler –> Custom Flags)

Debug: -DDEBUG

Release: -DRELEASE

Add a bridging header to import Objective-C code:

  1. Add empty header file to project (e.g., Bridging.h).
  2. Add all your #import statements in that file.
  3. In Project Build Settings, go to Swift Compiler - Code Generation and add path to previously created Bridging.h file.
  4. All Objective-C classes are available in Swift.
Avatar
Jonathan Fürst
Computer Science Researcher

I am a Computer Science researcher at NEC Labs Europe.