KMMBridgecocoapodsPublishing Podspecs to GitHub

While CocoaPods is still supported, we rarely use it for our client projects at this point. Some docs may be out of date. Please reach out if you find anything that seems off.

CocoaPods supports hosting private podspec repos. These are Git repos that only host release publishing info for CocoaPods podspecs, not their actual code. If you are planning to publish KMF Xcode Frameworks with CocoaPods, that means you’ll need a separate Git repo dedicated to publishing podspec versions. See the CocoaPods Documentation for more context.

Note

We highly recommend publishing from CI rather than from your local machine, although if properly configured you can do either. Our documentation generally assumes a CI configuration.

Creating a Podspec Repo

First you’ll need a separate git repo to store your remote podspecs. That repo will need at least one commit in it. CocoaPods won’t push to an entirely empty repo.

You may be tempted to attempt publishing your podspec definitions to the same repo you keep your code in. We have tried this. It is not recommended.

Adding the Spec Repo to Your Project

Once you’ve created a spec repo, you’ll need to pass the url to KMMBridge in the configuration block. Make sure to use the ssh url and not the https url. We haven’t found any docs that specifically say you can’t use https, but we’ve also not been able to get this to work.

kmmbridge {
    ...
    cocoapods("git@github.com:<ORG>/<PODSPEC REPO>.git")
    // NOT THIS
    // cocoapods("https://github.com/ORG/REPO.git")
}

Setting up access between these repos and CI is specific to the repo host and CI platform. To learn more about doing this specifically for GitHub, see the KMMBridge CocoaPods Quick Start

Publishing Podspecs to the Public Cocoapods Trunk

If you intend to publish a general public library, it is possible to publish to CocoaPods Trunk.

While this feature exists in KMMBridge, we have never actually used it. It has been left in KMMBridge on the remote chance that projects actually use it.

In addition, the CocoaPods project has publicly stated that CocoaPods Trunk will stop accepting updates within two years, as part of a general plan to shut the CocoaPods project down. Yes, CocoaPods is going away.

If you try to publish to CocoaPods Trunk and fail to do so, please reach out. We will try to help.

kmmbridge {
    ...
    cocoapodsTrunk()
}

Some alternate setup is required in order to publish to Trunk. See the Cocoapods documentation for details.