title: __has_include check a class exists against swift?
body: <p>In objective-c, I have something like:</p>
  
  <pre><code>#if __has_include(&lt;MyFramework/SomeFeature.h&gt;)
  SomeFeature *h = [SomeFeature new]
  #else
  OtherFeature *h = [OtherFeature new]
  #endif
  </code></pre>
  
  <p>How can we check if a class exists in swift? This link has some answer <a href="https://stackoverflow.com/questions/3057325/weak-linking-check-if-a-class-exists-and-use-that-class">Weak Linking - check if a class exists and use that class</a></p>
  
  <p>The good thing about <code>__has_include</code> is that it is a compile time check, but it only works for objective-c header. Do we have anything works for swift? Or maybe what I am doing is not a good approach? </p>
  
  <p>For example, I have a class <code>Machine</code> and it has a method <code>Gun</code>, if I have included a <code>Pistol</code> framework, it will return <code>Pistol</code>. If I have included both <code>Pistol</code> and <code>AK47</code>, it will return <code>AK47</code>, cause it has more bullets. </p>