目录
目录README.md

ExampleMergeSwiftModules

Example library showing how to break a library into multiple modules, but only require the consuming app to use a single import statement.

What this example shows:

For two targets, MainTarget and CoreTarget, where MainTarget depends on CoreTarget, we want to be able to write:

import MainTarget

And that is it, not:

import CoreTarget
import MainTarget

This is possible, if in MainTarget, as done in this example project, this is added:

@_exported import CoreTarget

It 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

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

关于
39.0 KB
邀请码