How can I integrate xcframework , static libraries to my own framework

I want to create SDK of my project don’t know how can I integrate third party static and dynamic libraries. Any help will be appreciated.

Hi @Shikharani,

First place to start is with the WWDC video from 2019/2020 that introduced XCFrameworks: Binary Frameworks in Swift - WWDC19 - Videos - Apple Developer and Distribute binary frameworks as Swift packages - WWDC20 - Videos - Apple Developer. I'd also recommend viewing Verify app dependencies with digital signatures - WWDC23 - Videos - Apple Developer (from this year) because of upcoming expectations on anyone creating an XCFramework - the gist of which is that in addition to assembling an XCFramework, you should expect to be responsible for signing it and encoding some data/assurances about it.

You mentioned 3rd party libraries - so this video isn't as relevant, but if you're making your own swift libraries and wanting to distribute them as XCFrameworks, it can be: Meet mergeable libraries - WWDC23 - Videos - Apple Developer

If you're building a library from another language (for example Rust) and looking for more concrete steps on how to turn that library into a library that you can call from swift as an XCFramework, I've documented some of my own work on that effort at Creating an XCFramework – Rhonabwy - but note that the article is very Rust specific.

Quite a lot of what I learned about creating an XCFramework beyond what's documented and invoking the xcodebuild -create-xcframework command (which is more about packing up libraries) was spelunking what the Mozilla team did to repackage rust libraries for Firefox-iOS. That's way deep in the weeds, but I expect the marker of where you can dig to learn more doesn't hurt.

-- Joe

1 Like