Jose Garcia
10/18/2023, 11:50 AMkotlin {
val xcf = XCFramework()
val iosTargets = listOf(iosX64(), iosArm64(), iosSimulatorArm64())
iosTargets.forEach {
it.binaries.framework {
baseName = "OriginalFramework"
isStatic = true
embedBitcode(BitcodeEmbeddingMode.BITCODE)
linkerOpts(
"-lsqlite3",
)
xcf.add(this)
}
}
AFAIK to do this I think I need XCode build setting “BUILD_LIBRARY_FOR_DISTRIBUTION” set to YES but I don’t have access to this setting as this is done using the multiplatform plugin.
I think this is linked to a Swift feature called “Library Evolution Support”a-dd
10/18/2023, 11:53 AMJose Garcia
10/18/2023, 12:04 PMOriginalFramework
) I can distribute to my customers. However, when we started to test out the use of this framework we realised that our API wasn’t too elegant. For example if we had a class named MyClass
on a MyClass.kt
file inside our kotlin code, when it was compiled and distributed to this framework we would have to use it as MyClassKt()
and we considered this is was not a very elegant API for out iOS customers so we decided to create a wrapper xcframework (WrapperFramework
) that would contain a Swift class MyInterface.swift
that would call the methods from our original framework.
On MyInterface.swift
I’m getting a compile error when I try to `import OriginalFramework`:
Module 'OriginalFramework' was not compiled with library evolution support; using it means binary compatibility for 'WrapperFramework' can't be guaranteed
OriginalFramework
was created via Kotlin multiplatform plugin
The WrapperFramework
was created via create new Framework from Xcode