

Provide values for two mandatory properties: If you want to use a pure C dependency, omit the language property. def file, for example f.Īdd a first string to this file: language = Objective-C. def file that describes this dependency to cinterop.Īdjust your build script to generate bindings during the build.ĭownload the library source code and place it somewhere where you can reference it from your project.īuild a library (library authors usually provide a guide on how to do this) and get a path to the binaries. The steps differ a bit for libraries and frameworks, but the idea remains the same.Ĭreate a special. This will allow you to call them from the Kotlin code. If you don't want to use CocoaPods, you can use the cinterop tool to create Kotlin bindings for Objective-C or Swift declarations. Perform initial CocoaPods integration setup.Īdd a dependency on a Pod library from the CocoaPods repository that you want to use by including the pod() function call in adle(.kts) of your project. Manage dependencies manually only if you want to tune the interop process specifically or if you have some other strong reason to do so.

We recommend using CocoaPods to handle iOS dependencies in Kotlin Multiplatform Mobile projects. Integration with the CocoaPods dependency manager is also supported with the same limitation – you cannot use pure Swift pods. Pure Swift dependencies are not yet supported.

Kotlin supports interoperability with Objective-C dependencies and Swift dependencies if their APIs are exported to Objective-C with the attribute. You can also reuse other libraries and frameworks from the iOS ecosystem in your iOS source sets. They do not require any additional configuration. Apple SDK dependencies (such as Foundation or Core Bluetooth) are available as a set of prebuilt libraries in Kotlin Multiplatform Mobile projects.
