Configuring iOS Dependencies, CI/CD, and Integration Issues in Kotlin Multiplatform Mobile (KMM) Projects
This technical guide details how to set up iOS dependencies, publish KMM libraries, build a GitLab CI/CD pipeline, and resolve common integration problems for Kotlin Multiplatform Mobile projects, providing code examples and best‑practice recommendations for mobile developers.
In this article, senior Ctrip R&D manager Derek explains how to configure iOS dependencies in a Kotlin Multiplatform Mobile (KMM) project, covering four dependency scenarios: system frameworks, partial API via cinterop, third‑party frameworks/libraries, and CocoaPods integration.
For each case, the necessary .def file and Gradle configuration are shown, e.g.:
language = Objective-C
headers = AAA.h BBB.h
compilerOpts = -I/xxx compilations["main"].cinterops.create(name) {
defFile = project.file("src/nativeInterop/cinterop/xxx.def")
packageName = "com.xxx.ioscall"
}The article also describes publishing the resulting KMM klib to a private Maven repository, with a sample publishing { repositories { maven { ... } } } block.
A complete CI/CD pipeline on GitLab is presented, consisting of stages pre, build, test, upload, and deploy, with scripts for installing a GitLab Runner, building the fat‑framework, running iOS simulator tests via a custom SimulatorTestsTask , and uploading test reports.
Common integration problems such as missing symbols when using static frameworks, Objective‑C categories in tests, and Swift library linking are addressed with linker options like linkerOpts("-ObjC") and Swift runtime paths.
References to official KMM documentation, KMMBridge, and related resources are provided.
Ctrip Technology
Official Ctrip Technology account, sharing and discussing growth.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.