title: ModuleName-Swift.h file not found in xcode8
body: <p>I'm trying to work on a mixed Swift and ObjectiveC project with no luck.</p>
  
  <p>My project is made of 6 targets:</p>
  
  <ul>
  <li>App</li>
  <li>Core</li>
  <li>CoreTest</li>
  <li>Summary</li>
  <li>WatchKit Extension</li>
  <li>WatchKit App</li>
  </ul>
  
  <p>I've been able to add a Swift class that has one target membership (App) and uses ObjectiveC code passing from the <strong>App-Bridging-Header.h</strong>
  The "ObjectiveC into Swift code" paradigm works like a charm.</p>
  
  <p>Instead, I'm struggling with the "Swift into ObjectiveC code" paradigm.
  In the specific case I need to use a new Swift class inside an ObjectiveC .m file that is member of four targets.</p>
  
  <p>What I've been doing so far is this:</p>
  
  <ol>
  <li>Add a new Swift file to the Core project specifying the four memberships (App, Core, Summary, WatchKit Ext)</li>
  <li>XCode asks to create <strong>-Bridging-Header.h</strong> for three projects Core, Summary and WatchKit Ext (App-Bridging-Header.h already exists since it was used previously), and I consent (don't know why it creates those files inside the same group folder where I add my Swift class but nevermind)</li>
  <li>I create the Swift class adding the <strong>@objc</strong> key before <strong>class</strong></li>
  <li>I go check if <strong>Objective-C Generated Interface Header Name</strong> is set for all modules, and yes it is</li>
  <li>I go check if <strong>Defines Module</strong> is set to <strong>No</strong> in all modules and set to <strong>Yes</strong> in the main project, and yes it is</li>
  <li>I write down the imports for the <strong>-Swift.h</strong> files for all the four targets</li>
  <li>Inside my Objective-C class I try to use my new Swift class, apparently it seems to work (even autocompletion)</li>
  <li>I try to build the project but it fails saying that the <strong>-Swift.h</strong> file is not found</li>
  </ol>
  
  <p>I've followed the <a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html" rel="noreferrer">Mix and Match guide of Apple</a> and many SO threads including <a href="https://stackoverflow.com/questions/39668619/xcode-8-with-mixed-swift-and-objective-c-project-generated-modulename-swift-h">this one</a> that seems apparently to address the same problem of mine but it doesn't work.</p>
  
  <p>Also have seen <a href="https://stackoverflow.com/a/26340915/5546499">this</a> and <a href="https://stackoverflow.com/questions/32098696/import-swift-class-in-objective-c-mymodule-swift-h-file-not-found">this</a> but didn't work.</p>
  
  <p>Have tried also to Delete Derived Data as well as cleaning the whole project several times with no luck.</p>
  
  <p><strong>EDIT 1 : More details</strong></p>
  
  <p>This is the declaration of my Swift class
      import RealmSwift</p>
  
  <pre><code>@objc class MyClass: Object {}
  </code></pre>
  
  <p>This is the snippet of usage of the Swift class inside ObjectiveC</p>
  
  <pre><code>MyClass *app = [[MyClass alloc] init];
  </code></pre>
  
  <p>If I avoid using #import ...-Swift.h the build fails saying that I'm making use of an Undeclared idenfier "MyClass" and this is sound.</p>
  
  <p>If I do use #import ...-Swift.h files it says that module X cannot find module Y and so on.</p>
  
  <p><strong>EDIT 2 : Swift module name</strong></p>
  
  <p>By looking at the <strong>SWIFT_OBJC_INTERFACE_HEADER_NAME</strong> property of each target I've seen that it is built using this syntax <strong>$(SWIFT_MODULE_NAME)-Swift.h</strong> do I need to change <strong>SWIFT_MODULE_NAME</strong> to <strong>MODULE_NAME</strong>?</p>
  
  <p><strong>EDIT 3 : Imports</strong></p>
  
  <p>This is the set of imports for Swift headers in .m ObjectiveC file.
  I'm using the module names specified in relative Build Settings properties. Notice that one has '_' character since WatchKit Extension target has a space in the target name.</p>
  
  <pre><code>#import "ProjectName_App-Swift.h"
  #import "ProjectName_Core-Swift.h"
  #import "ProjectName_Summary-Swift.h"
  #import "ProjectName_WatchKit_Extension-Swift.h"
  </code></pre>
  
  <p><strong>EDIT 4 : Cross visibility of -Swift.h files</strong></p>
  
  <p>I've tryed the following:</p>
  
  <ul>
  <li>Added a Swift class only in target App</li>
  <li>XCode created the Bridging Header</li>
  <li>Inserted #import "ProjectName_App-Swift.h" in ObjectiveC file used only by App</li>
  <li>Made use of Swift class inside this file</li>
  <li>It compiles! And I'm able to use the Swift class</li>
  </ul>
  
  <p>When the Swift class is defined for multiple targets and ObjectiveC file is used by those multiple targets it doesn't work. The build errors are like this: Target X -> "ProjectName_TargetY-Swift.h" file not found.
  Seems like a target cannot see other targets -Swift.h files.</p>
  
  <p>What am I doing wrong?
  Thanks for your help</p>