Kotlin native


Apollo Kotlin is built for multiplatform and therefore supports iOS, MacOS, and other Darwin targets.

Since version 3.5.0, the library requires executables to use the new Kotlin Native Memory Manager. To configure it on your project you can use the following snippet:

Kotlin
build.gradle.kts
1kotlin.targets.withType(KotlinNativeTarget::class.java) {
2    binaries.all {
3        binaryOptions["memoryModel"] = "experimental"
4    }
5}

More information is available on the migration guide.

Multithreaded coroutines

By default when using the x.y.z-native-mt branch of coroutines, Gradle replaces the -native-mt version with the non-mt version as outlined here. To prevent this, add the following to your root build.gradle.kts:

Kotlin
1allprojects {
2  configurations {
3    all {
4      resolutionStrategy {
5        force("org.jetbrains.kotlinx:kotlinx-coroutines-core:x.y.z-native-mt")
6      }
7    }
8  }
9}

This ensures that the same version is used everywhere, and that Gradle doesn't fail because -native-mt is a pre-release version (1.5.1-native-mt < 1.5.1).

Feedback

Edit on GitHub

Forums