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

Ivan Đorđević

04/01/2021, 2:29 PM
Hi, is it possible to combine exporting an umbrella framework (containing dependencies) with the CocoaPods plugin? https://kotlinlang.org/docs/mpp-build-native-binaries.html#export-dependencies-to-binaries Is there an example of this somewhere? Basically, is there a way to automate creating a .podspec file for such umbrella framework so that it can be integrated into iOS projects via CocoaPods?
Omitting the CocoaPods plugin would also do, as long as the podspec can also include the script to build the umbrella framework and embed it
k

kpgalligan

04/03/2021, 12:13 PM
I'm overdue to test this (sorry @russhwolf), but it should work: https://github.com/touchlab/KaMPKit/blob/rw/official-cocoapods/shared/build.gradle.kts#L104
Add an extension function for config
Copy code
fun CocoapodsExtension.framework(configuration: Framework.() -> Unit) {
    kotlin.targets.withType<KotlinNativeTarget> {
        binaries.withType<Framework> {
            configuration()
        }
    }
}
Then your cocoapods config looks like this:
Copy code
cocoapods {
        summary = "Common library for the KaMP starter kit"
        homepage = "<https://github.com/touchlab/KaMPKit>"
        framework {
            export(Deps.kermit)
            transitiveExport = true
        }
    }
i

Ivan Đorđević

04/05/2021, 8:36 AM
Thanks!
3 Views