Is it possible to “statically link” cocoapods depe...
# kotlin-native
k
Is it possible to “statically link” cocoapods dependencies? My team wants to avoid introducing a cocoapods build step, but we want to implement some functionality on top of a cocoapods library in KMM. As far as I can tell in the docs, using cocoapods in KMM bubbles up a cocoapods build requirement to the associated iOS build.
When applied, the CocoaPods plugin does the following:
• Creates a
podspec
task which generates a Podspec file for the project.
Without the support of swift package manager as part of the gradle build process, we’re left to use cocoapods or manually install the SDK. We’d prefer not to do this manually if we can avoid it.
l
You can pull down the cocoapod with pod install in an empty project, then manually cinterop it. If the framework is static, you should be fine. If it’s dynamic, you need to embed it in the final app.
We do something similar for a project at work. We created a prebuilts folder using git lfs to organize things, but this isn’t strictly necessary. You could put the framework wherever.
k
Ah, gotcha. Thanks! Great info.
l
You’ll probably want a script to handle updates to the library, since you won’t get the cocoapods versioning mechanisms. You may not even need to do pod install anywhere if you know where the release pod gets hosted.
k
I’ll have to weigh the pros and cons of this approach versus manually installing the SDK. Both require cinterop. Seems like cocoapods might be an additional layer of complexity for little gain.
This approach of course assumes that every iOS library we want to use can be manually installed. If not, we’ll have to fall back to this approach.