I am creating a KMP iOS project. I wish to: - cre...
# multiplatform
c
I am creating a KMP iOS project. I wish to: • create a stand-alone library (let’s call it
lib
) that consumes a native iOS dependency via Cocoapods • consume this library in my iOS app, whose KMP component is called
composeApp
• do this without having to manually include the native iOS dependency in my iOS app (i.e. the dependency should be transparently included in the native app) My
composeApp
build.gradle.kts
looks like:
Copy code
cocoapods {
  ios.deploymentTarget = "13.5"
  version = "1.0"
  summary = "..."
  homepage = "..."
  podfile = project.file("../iosApp/Podfile")

  framework {
    baseName = "ComposeAppFramework"

    export(project(":lib"))
    @OptIn(ExperimentalKotlinGradlePluginApi::class)
    transitiveExport = true
  }
}
My
lib
build.gradle.kts
looks like:
Copy code
cocoapods {
  ios.deploymentTarget = "13.5"
  version = "1.0"
  summary = "..."
  homepage = "..."

  pod("FirebaseAuth") {
    version = "11.4.0"
  }
}
My current problem is when I build my app I get the error:
Copy code
ld: framework 'FirebaseAuth' not found
Clearly my iOS app cannot find the
FirebaseAuth
pod. The generated
composeApp.podspec
does not contain a reference to
FirebaseAuth
, but the
lib
app’s
lib.podspec
does:
Copy code
spec.dependency 'FirebaseAuth', '11.4.0'
How can I make this dependency visible to my iOS app?
🧵 1
y
You can try making your
lib
a static framework which will mean it will bundle Firebase as part of its files AFAIK. Otherwise you want to stick with dynamic frameworks then define firebase in
iosApp/Podfile
as a dependency