Skip to content

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

License

Notifications You must be signed in to change notification settings

mhays118/TestMergingModulesInSPM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Related

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages