Skip to main content
Version: Next

Using CocoaPods

You'll need an Xcode project with CocoaPods set up. That means you'll have a Podfile that you can edit with the necessary code to integrate your Kotlin module.

Artifact Authentication

For artifacts that are kept in private storage, you may need to add authentication information so your ~/.netrc file or your Mac's Keychain Access. See the section here for a description of how to set up private file access.

Note: If your artifacts are in GitHub Pacakges for a public repo, you still need to configure GitHub auth for access to the artifacts.

Add Podspec Repo

In your Podfile, add the module and the source. An example Podfile might look like this:

platform :ios, '13'

source 'https://github.com/touchlab/PublicPodspecs.git'

target 'KMMBridgeSampleCocoaPods' do
pod 'shared', '0.2.1'
end

Then, to initialize CocoaPods, run:

pod install

As you publish new versions of the library, you will need to update the local podspec repo copy. Either run:

pod repo update

Or update the podspec when you're updating your CocoaPods project:

pod install --repo-update
# Or...
pod update --repo-update

Assuming that all worked, you should be able to open the project and build it.

If you are using a private podspec repo, your setup should work if you've added the authentication above. If the files can't be synced, make sure to double-check the auth setup.

VERY IMPORTANT!!!

After you run pod install, CocoaPods generates an xcworkspace file. There is usually both an xcodeproj and an xcworkspace. Make sure you open the xcworkspace file!!!

xcworkspacefile

Local Kotlin Dev

If you are editing Kotlin, you will probably want to test it locally. To do that, see IOS_LOCAL_DEV_COCOAPODS.

Touchlab KMP Insiders Newsletter

Subscribe