title: How to detect if app is being built for device or simulator in Swift
body: <p>In Objective-C we can know if an app is being built for device or simulator using macros:</p>
  
  <pre><code>#if TARGET_IPHONE_SIMULATOR
      // Simulator
  #else
      // Device
  #endif
  </code></pre>
  
  <p>These are compile time macros and not available at runtime.</p>
  
  <p><strong>How can I achieve the same in Swift?</strong></p>