Example library showing how to break a library into multiple modules, but only require the consuming app to use a single import statement.
For two targets, MainTarget and CoreTarget, where MainTarget depends on CoreTarget, we want to be able to write:
import MainTargetAnd that is it, not:
import CoreTarget
import MainTargetThis is possible, if in MainTarget, as done in this example project, this is added:
@_exported import CoreTargetIt will not prevent users/consumers of MainTarget from manually importing CoreTarget, but it will not be required.
Note that this is an experimental feature.
Create XCFrameworks with:
swift create-xcframework CoreTarget MainTarget --zip
Note that all targets need to be listed.
To see how to distribute as XCFrameworks, look at the following repo: https://github.com/mhays118/TestDistributingXCFrameworks
For example consuming app (with single import), see: https://github.com/mhays118/TestSPMLibraryConsumerApp