https://kotlinlang.org logo
#ios
Title
# ios
d

dazza5000

09/03/2020, 3:33 PM
How do you package an iOS framework for external consumption? Any recommended approach?
s

Sam

09/03/2020, 3:36 PM
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

dazza5000

09/03/2020, 3:37 PM
is swift package manager supported by apple
n

Nikolay Kasyanov

09/03/2020, 4:03 PM
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

Romain Dubreucq

09/03/2020, 5:22 PM
I managed to make it work with CocoaPods, let me know if you are interested
k

kpgalligan

11/02/2020, 1:35 PM
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

Romain Dubreucq

11/02/2020, 1:41 PM
Here is a working podspec that uses FatFrameworkTask
k

kpgalligan

11/02/2020, 1:44 PM
Interesting, thanks!
r

Romain Dubreucq

11/02/2020, 1:44 PM
Feel free to ping me if you have issues
👍 1
k

kpgalligan

11/02/2020, 2:26 PM
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

Romain Dubreucq

11/02/2020, 2:27 PM
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

kpgalligan

11/02/2020, 2:55 PM
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

Romain Dubreucq

11/03/2020, 9:43 AM
Hello, you can share your podspec and your fat framework task if you want me to check
k

kpgalligan

11/03/2020, 2:27 PM
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.