title: Why does my Swift bundle get the wrong principal class?
body: <p>I made a bundle target, and its <code>Info.plist</code> file specifies that a very specific class (let's call it <code>PrincipalClass</code>) should be its principal class. This class was written in Swift and has the <code>@objc</code> attribute. The <code>Info.plist</code> file is correctly copied over to the bundle, and I have cleaned and rebuilt the project multiple times already.</p>
  
  <p>However, when I load the bundle from my Swift framework, its principal class is a different class (let's call it <code>NotPrincipalClass</code>). It was not marked <code>@objc</code>, and in fact, it should be internal to the bundle. I checked <code>bundle.bundleURL</code> in the debugger, and the <code>Info.plist</code> file in the bundle does say that it should be <code>PrincipalClass</code>; but when I check <code>bundle.infoDictionary</code>, the <code>NSPrincipalClass</code> attribute reads <code>NotPrincipalClass</code> as a string! (The info dictionary also contains several keys that were not specified by the <code>Info.plist</code> file, like <code>DTCompiler</code> and such.)</p>
  
  <p>If I entirely remove <code>NotPrincipalClass</code>, I get another internal class instead, which is still totally not my principal class.</p>
  
  <p>I checked the build logs thoroughly and I saw no mention of <code>NotPrincipalClass</code>, except when it got compiled.</p>
  
  <p>What could cause this? What can I do to solve it?</p>