title: „no such module“ error for custom framework
body: <p><strong>The goal:</strong> </p>
  
  <p>I want to use a custom framework in order to make certain methods and properties only accessible within the framework, and not by other classes of the app.  </p>
  
  <p><strong>What I did:</strong>  </p>
  
  <p>I followed <a href="https://www.raywenderlich.com/126365/ios-frameworks-tutorial" rel="nofollow noreferrer">this tutorial</a>: For testing purposes, I setup a new framework project, copied 1 class from the original project to this new project, and made the initialisers and some other functions public. This framework project builds without errors.  </p>
  
  <p>I then removed the copied class from the original project. As expected, it does no longer build and shows „undeclared type“ errors for the removed class.  </p>
  
  <p>To add the framework project as a subproject to the original project, I added the framework project’s <code>xcodeproj</code> file, and added the frameworks <code>framework</code> file as an embedded binary to my original project target, which adds it automatically to „Linked Frameworks and Binaries“. Eventually, I the added <code>import MyFramework</code> statements to the relevant 2 files that use the class that was moved to the framework.</p>
  
  <p><strong>The problem:</strong>  </p>
  
  <p>When I build, the „undeclared type“ errors are now completely gone, but I get „no such module“ errors at the import statements.<br>
  This means that the public class and its public functions of the framework are visible to the original project.<br>
  But why do I anyway get „no such module“ errors? And what should I do to fix my problem?</p>
  
  <p>PS:  </p>
  
  <p>I have read the „no such module“ posts on SO, but none of them seems to address my problem.</p>
  
  <p><strong>EDIT</strong>  </p>
  
  <p>A friend of mine pointed out that there is a big difference between the cited tutorial app and mine. Sorry that I did not mention this. I was not aware of its relevance:  </p>
  
  <p>The tutorial app has a single target, iOS, whereas my app has 2 targets, iOS and watchOS. The class that I moved to my framework is used by both targets.   </p>
  
  <p>Since the class that I moved to my framework is used by both targets, the framework needs also the same targets and a build produces two products, one framework for iOS and one framework for watchOS, see my answer below.</p>