Swift Journey Log

Aug 4, 2015 · 1 minute read · Comments
#Apple #Swift #Coding #iOS

Using Preprocessor Macros:

func println(object: Any) {
    #if DEBUG

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.
comments powered by Disqus