Member-only story
How to Add Compiled Frameworks in Swift Package Manager
Swift 5.3 brings binary dependency or compiled frameworks to SPM
At last, a long-awaited feature comes to Swift. Swift 5.3 will enable you to add binary dependencies in Swift Package Manager. Why does this sound fantastic? Because before Swift 5.3, SPM (Swift Package Manager) only enabled source-code libraries as a dependency, which meant that lots of enterprise software (which often comes as closed-source) or closed-source libraries couldn’t be added as a dependency in SPM, like Firebase or Google Analytics.
SE-0272 by Braden Scothern, Daniel Dunbar, and Franz Busch brings binary dependencies capability to Swift 5.3, which means you can add compiled frameworks to your SPM. But keep in mind that only xcframework
format is supported for now. (Other types of frameworks were still under discussion when this article was being written. See more detail here).
What is xcframework ?
xcframework
is a format that Apple introduced back in WWDC 2019, where it was discussed in “Binary Frameworks in Swift.”
There are several advantages of using xcframework
, like multiple architectures and platforms (including simulator type), and no slicing x86_64 before uploading to AppStore.