Encore KMP SDK
Kotlin Multiplatform SDK for Encore — thin bridge delegating to native iOS and Android SDKs.
Installation
Gradle (KMP / Android)
dependencies {
implementation("com.encorekit:encore-kmp:0.1.0")
}
iOS (CocoaPods)
The iOS target is distributed via the KMP cocoapods plugin. In your KMP project's build.gradle.kts:
cocoapods {
pod("EncoreKit") { version = "1.4.36" }
}
Quick Start
Common (Shared Code)
import com.encorekit.kmp.Encore
import com.encorekit.kmp.models.PresentationResult
Encore.identify(userId = "user_123")
val result = Encore.placement("cancel_flow").show()
when (result) {
is PresentationResult.Granted -> println("Offer accepted: ${result.offerId}")
is PresentationResult.NotGranted -> println("Declined: ${result.reason.value}")
}
Android Setup
Encore.configure(context = this, apiKey = "pk_xxx")
Encore.setActivity(this)
Encore.setActivity(null)
iOS Setup
Encore.configure(apiKey = "pk_xxx")
The iOS target requires CocoaPods. The EncoreKMPBridge pod (included in iosHelper/) wraps the Swift-only EncoreKit APIs for Kotlin/Native cinterop.
Platform-Specific Setup
Android
- Context: Pass
applicationContext in configure() — required for the native SDK
- Activity: Set via
Encore.setActivity(activity) — required for presenting offer UI
- Min SDK: 26
iOS
- CocoaPods: The KMP cocoapods plugin generates a pod from the
shared module
- Deployment Target: iOS 15.0
- Bridge:
iosHelper/EncoreKMPBridge.swift provides @objc wrappers for cinterop
API Reference
Development
make test
make build
make publish-local
make demo-android
make demo-ios
make release
Architecture
commonMain/ Public API (Encore object, models, expect classes)
androidMain/ Delegates to com.encorekit:encore (Maven Central)
iosMain/ Delegates to EncoreKMPBridge → EncoreKit (CocoaPods)
iosHelper/ Swift @objc bridge for cinterop
The SDK is a thin bridge (~600 LOC) with zero business logic — all behavior is delegated to the native SDKs.