How to make Swift submodule really private?

I found another question that gives more detailed information about the problem and possible solutions. There seems to be a known bug that is the subject of future improvements.

C Objective Classes in iOS Swift Dynamic Infrastructure

I am developing the environment in Swift, and I am using Objective-C code inside the framework. So far, my module map looks like this:

framework module MyModule { umbrella header "MyModule-umbrella.h" export * explicit module Private { header "MyTools.h" } } 

My concern is that all the APIs from MyTools.h are visible from outside the frame: for example, if you install the framework using Cocoapods, then you import MyModule into your application ( not MyModule.Private ), you can access MyTools.h , which undesirable and redundant. Is there a way to make invisible MyTools out of bounds?

PS. I use Cocoapods to distribute the framework, here is my podspec (the most significant part):

 s.module_map = 'Pod/MyModule.modulemap' s.frameworks = 'CoreData', 'CoreTelephony', 'SystemConfiguration' s.resources = 'Pod/Classes/MessageStorage/*.xcdatamodeld' s.public_header_files = 'Pod/Classes/**/*.h' s.private_header_files = 'Pod/Classes/MyTools/**/*.h' s.source_files = 'Pod/Classes/**/*.{h,m,swift}' 

Pss. My umbrella header does not import MyTools.h

PSSS. Just tried to exclude the header from the main module:

 framework module MyModule { umbrella header "MyModule-umbrella.h" export * exclude header "MyTools.h" explicit module Private { header "MyTools.h" } } 

Bad luck.

+5
source share
1 answer

I found another question that contains more detailed information about the problem and possible solutions (which do not work). There seems to be a known bug that is the subject of future improvements.

C Objective Classes in iOS Swift Dynamic Infrastructure

+2
source

Source: https://habr.com/ru/post/1262580/


All Articles