Closed modular framework

I'd like to modularize a framework for use between different client applications, depending on each client application it can have different modules. I've tried splitting modules into dependencies which I build into xcframeworks. But I'd like for my modules to only be usable by the final framework and not by the client application. Is there any way to achieve this?
Closed modular framework
 
 
Q