title: Shimming in Swift
body: <p>According to Apple engineer Elizabeth Reid "shimming" is when you use conditional compilation to reuse code between iOS and OS X. For example:</p>
  
  <pre><code>#if TARGET_OS_IPHONE
  @import UIKit;
  #define BaseView UIView
  #else
  @import AppKit;
  #define BaseView NSView
  #endif
  
  @interface MyView : BaseView
  
  @end
  </code></pre>
  
  <p>In the WWDC 2014 session <a href="http://asciiwwdc.com/2014/sessions/233">Sharing code between iOS and OS X</a> she also states: </p>
  
  <blockquote>
    <p>If you literally translate how you would shim with Objective-C, this
    will not compile in Swift.</p>
    
    <p>There are ways to shim your code in Swift.</p>
    
    <p>But it gets more complicated than your basic conditional compilation
    that we can use in Objective-C.</p>
  </blockquote>
  
  <p>So, which are the ways to "shim your code" in Swift?</p>