How do you package an iOS framework for external ...
# ios
d
How do you package an iOS framework for external consumption? Any recommended approach?
s
At a minimum you can just zip up the framework bundle and distribute it. Most people choose a package manager like Cocoapods. Swift Package Manager may now work since it supports binaries now as well.
d
is swift package manager supported by apple
n
IIRC SwiftPM’s binary framework support is coming with Xcode 12
but binaries have to be packed as XCFramework, the Kotlin’s FatFramework task doesn’t support it as of yet.
r
I managed to make it work with CocoaPods, let me know if you are interested
k
I'm very interested in this. Have been wrestling with it for a few days. @Romain Dubreucq Do you mean CocoaPods and XCFramework? I can get an XCFramework to work directly, but when I try to push that into a cocoapods repo, it fails. I've also tried using the fat framework task, but that fails on archive.
r
Here is a working podspec that uses FatFrameworkTask
k
Interesting, thanks!
r
Feel free to ping me if you have issues
👍 1
k
Any chance you've ever seen this? We keep getting it when attempting to validate and push the archive to app store connect.
I'm going to do a full clean and try again. See if I can figure that out.
r
You said that you were using XCFramework? Because I don't think that I'm using them on my side
The two last lines of the podspec are a workaround to fix an issue with Xcode 12 to prevent using arm64 in simulator (Xcode 12 is prepared to build for Apple Silicon)
k
Not using XCFramework with that test. I have multiple different attempts going on. In this case, I get that error after running the fat framework task. It all seems to work fine, until validating and/or trying to distribute to the app store. Digging some more, though.
Waiting on confirmation, but I’m pretty sure it was something else in the podspec and had nothing to do with fat framework at all. Kind of a big self-own, and another instance of “be careful with copy/paste”
r
Hello, you can share your podspec and your fat framework task if you want me to check
k
No, we figured it out. We had reused another podspec which had
spec.resources               = '*'
in it. I believe that copied the binary file directly into the framework resources, and the "Mach-O header" error was caused by the verifying seeing that file. Pulling out the resources line fixed the issue.