Installation¶
All modules are published to Maven Central under the ru.sulgik.mapkit group.
Built against Yandex MapKit SDK 4.42.0-lite
The wrapper targets the lite build. Your project links MapKit itself, so use the same version there.
| Module | Gradle dependency | Description |
|---|---|---|
| Wrapper | ru.sulgik.mapkit:yandex-mapkit-kmp:1.0.0-beta01 |
The MapKit API in common code |
| Compose | ru.sulgik.mapkit:yandex-mapkit-kmp-compose:1.0.0-beta01 |
Rendering the map with Compose Multiplatform, plus compose-resources as map images |
| Moko | ru.sulgik.mapkit:yandex-mapkit-kmp-moko:1.0.0-beta01 |
moko-resources as ImageProvider. Needs platform-side initialization |
| Moko Compose | ru.sulgik.mapkit:yandex-mapkit-kmp-moko-compose:1.0.0-beta01 |
The same in a composable context, with no platform-side initialization |
Requirements¶
- Android — minimum SDK 26.
- iOS —
iosArm64andiosSimulatorArm64.iosX64was dropped, because Compose Multiplatform no longer publishes for it. - Kotlin 2.4.10, Compose Multiplatform 1.11.1 for the Compose modules.
- An API key from Yandex.
Linking MapKit itself¶
MapKit is not a transitive dependency of these modules — you add it yourself, with the version above.
The Gradle dependency is enough; add it to the Android source set of the module that links your application.
kotlin {
sourceSets {
androidMain.dependencies {
implementation("com.yandex.android:maps.mobile:4.42.0-lite")
}
}
}
kotlin {
cocoapods {
pod("YandexMapsMobile") {
version = "4.42.0-lite"
}
}
}
Add YandexMapsMobile to the Xcode project the usual way and expose it to Kotlin through
SPM interop.
iOS needs the link on your side
Klibs cannot carry the native framework, so a project that does not link Yandex MapKit SDK itself fails at link time, not at compile time.
The main module¶
yandex-mapkit-kmp is the wrapper: MapKit's own API, reachable from commonMain. It draws nothing
by itself — see Wrapper overview for how a platform MapView reaches
common code.
kotlin {
sourceSets {
commonMain.dependencies {
implementation("ru.sulgik.mapkit:yandex-mapkit-kmp:1.0.0-beta01")
}
}
}
Compose Multiplatform¶
yandex-mapkit-kmp-compose draws the map as a composable and manages map objects through a
composition of their own: YandexMap, Placemark, Polyline, Polygon, Circle, Clustering,
MapObjectCollection, TileLayer, MapObjectLayer, TrafficLayer, MapListeners,
CameraPositionState and MapEffect.
It already brings the wrapper
The module depends on yandex-mapkit-kmp as an api dependency, so a separate declaration is
only needed when you want to pin its version explicitly.
kotlin {
sourceSets {
commonMain.dependencies {
implementation("ru.sulgik.mapkit:yandex-mapkit-kmp-compose:1.0.0-beta01")
}
}
}
moko-resources¶
yandex-mapkit-kmp-moko turns images generated by
moko-resources into an ImageProvider. It adds
MOKOImageLoader with the platform implementations AndroidMOKOImageLoader (needs a Context) and
IOSMOKOImageLoader, which you create on the platform side and pass into common code.
kotlin {
sourceSets {
commonMain.dependencies {
implementation("ru.sulgik.mapkit:yandex-mapkit-kmp-moko:1.0.0-beta01")
}
}
}
moko-resources in Compose¶
yandex-mapkit-kmp-moko-compose adds rememberMOKOImageLoader(), which builds the platform
implementation for you, so nothing has to be passed down from the platform side.
kotlin {
sourceSets {
commonMain.dependencies {
implementation("ru.sulgik.mapkit:yandex-mapkit-kmp-moko-compose:1.0.0-beta01")
}
}
}
Both moko modules are described on Image resources.