https://kotlinlang.org logo
#kotlin-native
Title
# kotlin-native
j

Justin

11/03/2021, 7:02 PM
For those of you who haven't yet fully descended down the rabbit hole that is building a truly universal XCFramework for all iOS and macOS platform variants, I have published a gist with some custom gradle tasks that generate the desired result. Specifically, if you have a Kotlin Multiplatform library targeting all modern Macs (M1 Apple Silicon and Intel) and all iOS devices and simulators: •
iosx64
iosArm64
iosSimulatorArm64
macosX64
macosArm64
...you can use these tasks to generate an XCFramework that works for all of them. XCFramework.kts The only 'official' Apple documentation on how to create such a framework (at least that I could find) is in an Apple forums post, so hopefully sharing this will (a) save other people time, and (b) lead to improvements on my amateurish gradle code!
🔍 1
👍🏼 1
🎉 5
s

Sam

11/03/2021, 8:02 PM
1.5.30 introduced support for XCFrameworks. https://kotlinlang.org/docs/whatsnew1530.html#support-for-xcframeworks. Does your code need to work differently?
j

Justin

11/05/2021, 5:16 PM
Unfortunately, using the built-in support does not do the lipo'ing necessary to produce a universal XCFramework (at least as of the last time I tried it, which was in the 1.5.31 series). Of course I would love to nuke the code I shared into oblivion in favor of a built-in way to do this...
l

louiscad

11/11/2021, 10:15 AM
Would you open an issue on kotl.in/issue requesting universal XCFrameworks support, and linking your script?
4 Views