Implementation detail modulemaps. How to hide them?

Hi @jrose ,
From https://bugs.swift.org/browse/SR-655?focusedCommentId=12201&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-12201, my understanding is that it is not possible to make a swift module that wraps some c-headers and then hides them as an implementation detail.

Just for clarity sake, I'm experimenting with exporting just the .swiftmodule and .so files, and I'd like to have something like the following (but where I do not need to export the modulemap):

MyModule.swift:
// ... some sort of wrapper...
module.modulemap:
module PrivateDetail {
  export *
  header "private-detail.h"
}

Is this possible? If so, how?
If not, what would be necessary to make this possible? I'm interested in making the needed changes.

That's correct: Swift currently does not have a supported way to hide dependencies from clients. We're experimenting with one solution under the spelling @_implementationOnly import, but it still has a bunch of caveats (and bugs). I'm hoping to post more about that soon; if you're interested in the general area you can also see some more ambitious discussion in @_exported and fixing import visibility.

3 Likes
Terms of Service

Privacy Policy

Cookie Policy