Hey all :wave: I’m developing a KMP library that w...
# ios
b
Hey all 👋 I’m developing a KMP library that will be used by native Android (Compose), native iOS, and Compose Multiplatform. I have a few dependencies that I need to include on the iOS side of things and both are available via cocoapods and SPM. Is there a way to setup gradle to support cocoapods AND spm or is it an either or? I attempted to generate a swift package but I’m getting
(no such file, not in dyld cache),
for the two libraries when running a barebones iOS app with the SDK swift package imported
k
There should be a way to include cocoa pods into your iosMain
Copy code
kotlin {
    cocoapods {
        ...
        pod("AFNetworking")
    }
}
Something like this
b
does this allow it to bundle in the spm too?
this is the ios section of my build.gradle
Copy code
iosArm64()
    iosSimulatorArm64()
    listOf(
//        iosX64(),
        iosArm64(),
        iosSimulatorArm64(),
    ).forEach { iosTarget ->
        iosTarget.binaries.framework {
            baseName = "BotStacksSDK"
            isStatic = false
            export(libs.compose.adaptive.ui)
        }
    }

    cocoapods {
        summary = "Some description for the Shared Module"
        homepage = "Link to the Shared Module homepage"
        version = libs.versions.libraryVersion.get()
        ios.deploymentTarget = libs.versions.ios.deploymentVersion.get()
        framework {
            baseName = "BotStacksSDK"
            isStatic = false
            export(libs.compose.adaptive.ui)
            export(libs.sentry)
        }

        pod("Sentry") {
            version = "8.20.0"
            extraOpts += listOf("-compiler-option", "-fmodules")
        }

        pod("Giphy") {
            moduleName = "GiphyUISDK"
            version = "2.2.8"
            extraOpts += listOf("-compiler-option", "-fmodules")
        }

        pod("Gifu") {
            git("<https://github.com/kaishin/Gifu.git>") {
                branch = "master"
            }
            extraOpts += listOf("-compiler-option", "-fmodules")
        }
    }
and my multiplatformswiftpackage block
Copy code
multiplatformSwiftPackage {
    packageName("BotStacksSDK")
    swiftToolsVersion("5.9")
    targetPlatforms {
        iOS { v("14") }
    }
    buildConfiguration { debug() }
    distributionMode { local() }
    outputDirectory(file("${rootDir.absolutePath}/BotStacksSDKSwiftPackage"))
}
k
I don't think it will support SPM. Kotlin Multiplatform only supports importing cocoa pods I think