title: Xcode: "No such module" embedded framework
body: <p>I currently have 3 Embedded Frameworks in my project:</p>
  
  <ul>
  <li><code>PersistenceLayer</code> (Swift only)</li>
  <li><code>TransportLayer</code> (Swift Only)</li>
  <li><code>Socket</code> (Objc)</li>
  </ul>
  
  <p>Both <code>PersistenceLayer</code> and <code>Socket</code> don't reference anything outside themselves.  However <code>TransportLayer</code> imports <code>PersistenceLayer</code> and <code>Socket</code>.  Oddly, I can <em>use</em> <code>PersistenceLayer</code> objects after importing:</p>
  
  <pre><code>import PersistenceLayer
  
  struct User : Model {
    ...
  }
  </code></pre>
  
  <p><code>Model</code> is defined in <code>PersistenceLayer</code> and Xcode lets me use it per normal.  However, when I try to build <code>TransportLayer</code>, I get the error: <code>No such Modul 'Persistencelayer'</code>.  So Xcode recognizes the module is there, but somehow "looses" it when it builds.</p>
  
  <p>What's maddening is that this used to work.  At some point something changed and I can't figure out what.  It's important to note that I work on a project with multiple developers and I have <code>merged</code> in changes.  However switching to a commit prior to the merge didn't work.  I've also tried:</p>
  
  <ul>
  <li>Adding <code>$(SRCROOT)</code> (recursive) to Framework Search Paths</li>
  <li>Deleting everything out of <code>ModuleCache</code> directory</li>
  <li>Clean project</li>
  <li>Clean Build Folder</li>
  </ul>
  
  <p>I suspect that something changed in my project settings but I can't figure out what and I've checked the git diffs didn't help (there nothing that really changed in the project aside from the normal file additions.</p>
  
  <p>Also, <code>TransportLayer</code> does successfully import and use <code>Socket</code>.  I can build the TransportLayer if I remove references to <code>PersistenceLayer</code> but keep all the references to <code>Socket</code>.</p>
  
  <p>Does anyone know why this might be occurring or how to fix it?</p>
  
  <h2>Update</h2>
  
  <p>Ok, so I removed the "offending" files from the target to make sure <code>Socket</code> was working (it is) and then re-added the files to the target (quite literally by resetting git).  It now builds... cause that makes sense.  But I tried changing the Scheme from <code>iOS Device</code> to a simulator and it no longer builds, but I'm getting different errors:</p>
  
  <ul>
  <li>in module.modulemap: <code>Header</code>PersistenceLayer-Swift.h' not found`</li>
  <li>Also: <code>Could not build Objective-C module 'Persistence Layer'</code></li>
  </ul>
  
  <p>This feels like I'm chasing down random errors...</p>