**The goal:** 

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. 

**What I did:** 

I followed [this tutorial](https://www.raywenderlich.com/126365/ios-frameworks-tutorial): 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. 

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. 

To add the framework project as a subproject to the original project, I added the framework project’s `xcodeproj` file, and added the frameworks `framework` file as an embedded binary to my original project target, which adds it automatically to „Linked Frameworks and Binaries“. Eventually, I the added `import MyFramework` statements to the relevant 2 files that use the class that was moved to the framework.

**The problem:** 

When I build, the „undeclared type“ errors are now completely gone, but I get „no such module“ errors at the import statements.  

This means that the public class and its public functions of the framework are visible to the original project.  

But why do I anyway get „no such module“ errors? And what should I do to fix my problem?

PS: 

I have read the „no such module“ posts on SO, but none of them seems to address my problem.

**EDIT** 

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: 

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. 

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.