Engineering. Building KMP SDKs Without CocoaPods: RevenueCat's Gradle-Swift Integration
Original title: Wrapping a Swift Package in a Gradle Module: How RevenueCat's KMP SDK Builds purchases-ios Without CocoaPods
RevenueCat's Kotlin Multiplatform SDK version 3.0.0 represents a significant architectural shift in how iOS dependencies are integrated into cross-platform mobile development. Traditionally, Kotlin/Native relied on the CocoaPods plugin to bridge the gap between Kotlin code and Apple frameworks, since cinterop (the tool generating Kotlin bindings from C and Objective-C headers) required a structured dependency format that CocoaPods provided. However, Swift packages present a unique challenge: they lack C headers that cinterop can directly read, and Gradle cannot natively compile Swift code. RevenueCat solved this by wrapping Swift packages within Gradle modules, creating a custom integration layer that allows cinterop to work with Swift dependencies without CocoaPods as an intermediary.
For mobile studios building cross-platform applications, this approach opens new possibilities for streamlining build pipelines and reducing dependency management complexity. By eliminating CocoaPods, teams can consolidate their build configuration into a single Gradle-based system, potentially reducing build times and simplifying CI/CD workflows. The technique demonstrates how custom Gradle modules can bridge platform-specific code, offering a template for other KMP projects facing similar integration challenges. Understanding this pattern becomes valuable as more teams adopt Kotlin Multiplatform for iOS and Android development, especially when managing proprietary or Swift-native SDKs that don't fit traditional CocoaPods workflows.




