I have a KMM project that I would like to publish to a private cocoapods repo.
The project also has an iOS pod implementing the specific iOS UI with UIKit.
Project structure looks something like this:
.
├── MyKMMAwesomeModule
│ ├── MyKMMAwesomeModule.podspec
│ ├── build
│ ├── build.gradle.kts
│ └── src
├── MyUI
│ ├── MyUI.podspec
│ ├── README.md
│ ├── Sources
│ └── Tests
I'm using the kotlin-cocoapods plugin to generate the podspec file.
kotlin {
...
cocoapods {
name = "MyKMMAwesomeModule"
publishDir = project.file("../../")
framework {
baseName = "MyKMMAwesomeModule"
isStatic = false
transitiveExport = false
}
...
}
}
I would like the generated podspec file to be in the root folder, so I can have multiple pods published from the same repository. To achieve this I'm using publishDir
, but that doesn't seem to have any effect. Since one podspec is manually written and the other is generated, I don't want to use subspecs.
See publishDir
reference here.
The podspec generated by Kotlin is for local development, not for publishing. I've never used publishDir
, so I'm not sure what that's intended to do. Privated cocoapods podspec repos would expect a podspec that is designed for "publishing". You'll need to package and distribute the binary framework somewhere as well.
We have an open source project for publishing Kotlin Xcode Framework binaries. https://kmmbridge.touchlab.co/. You can configure it to publish to private podspec repos. There are several options for hosting the binary, but the most common is in github artifacts.
In theory, you could publish the Kotlin framework and have the UI framework depend on that. I'm less familiar with subspecs, though there may be a way to publish with that.
Local dev for the frameworks is another consideration. You'd want to be able to develop the Kotlin and UI locally, but publish them to the podspec repo, which would mean different podspecs for local and remote.