Options for switching between incorporating binary and/or source code within an app

Our company is going to develop an iOS library of functionality for inclusion in several apps, some of the apps will be developed in-house and some externally.

When the library is included in external apps the source code shouldn't be visible. When the library is included in internal apps, having the option to view and step through the code within the library will be invaluable for debugging.

How could I set things up so that two forms of the library can be easily generated - one exposing source code and the other not. Ideally they should be capable of being incorporated within the apps in the same manner regardless of if the source code is expose or not Is that possible?

I looked at Swift Packages, but it seems its for distribution of source code only, and its not possible to hide the source code. However, conversely, a framework only contains binary and no source code.

Is there any other option?

Options for switching between incorporating binary and/or source code within an app
 
 
Q