title: Conditional Imports in Swift
body: <p>I have a Log function I use in various apps. Its convenient for this to also make Crashlytics logging calls since I use it throughout the app.</p>
  
  <p>However, not every app uses Crashlytics. In Objective C you could handle this with preprocessor conditions.</p>
  
  <p>How would one handle this in code? I think there are ways to make the function conditional perhaps. But how would I optionally or weak import Crashlytics?</p>
  
  <pre><code>import Foundation
  //import Crashlytics
  
  /// Debug Log: Log useful information while automatically hiding after release.
  func DLog&lt;T&gt;(message: T, filename: String = __FILE__, function: String = __FUNCTION__, line: Int = __LINE__) {
  //    CLSLogv("\(NSString(string: filename).lastPathComponent).\(function) line \(line) $ \(message)", getVaList([]))
      print("[\(NSString(string: filename).lastPathComponent) \(function) L\(line)] \(message)")
  }
  </code></pre>