Why internal classes appear in ProductName-Swift.h? May I change this file manually?

I build Swift framework that is dependent on another Objective C framework (so, the project contains bridging header file). When I open auto-generated ProductName-Swift.h file inside my framework’s headers I see that classes that I would not like to expose (those with internal modifier). According to Apple Docs it’s legit:

 

By default, the generated header contains interfaces for Swift declarations marked with the public or open modifier. If your app target has an Objective-C bridging header, the generated header also includes interfaces marked with the internal modifier.

 

But why does it happen? Can anyone explain me, please? According to my logic, if I decide to make some code to be internal it shouldn’t be used outside of my framework and it shouldn’t be exposed in a header.

 

Anyway, I can write a bash script that will delete internal classes and functions from ProductName-Swift.h after the build, but I’m not sure if it’s ok to do such a thing. Will the user have any problems while using my Swift framework with “fixed” ProductName-Swift.h inside his Objective C project, for example?

Powered by WPeMatico

You may also like...

Comments are closed.