Hi, I'm trying to build a Swift package which exposes certain functionality in a multi-platform way. Different platforms will have specific implementations of protocols defined at the core. I would like, however, that whoever is consuming my library - is able to use just ONE single import. I see that if I follow my structure, the user app would have to import my internal modules/targets independently, which is not desired.
- Core Protocols and Structures ("CoreLib" target) - bottom layer
Then I define implementations that are platform-specific: middle layer
- macOS + iOS implementations ("AppleLib" target)
- Linux implementations ("LinuxLib" target)
Finally I have a top layer which depends on Core + (compile time conditional on platform Lib). This is my "LibX"
So, I expect that if my user app wants to consume these APIs, they should be able to just use
import CoreLib // this should be an implementation detail import LibX
The internal structure of my modules/targets should be an implementation detail that shouldn't be exposed to the consumers of the library. This would be very handy if in the future I refactor my library without breaking the APIs and signatures.
Is this supported or planned?