Kotlin Multiplatform

5 concepts · 15 practice questions

Shared code and source sets

Code in commonMain compiles for every target; androidMain and iosMain hold platform code. Common code can only use Kotlin and multiplatform libraries, not java.* or Android APIs. Teams usually share data, networking and business logic first and keep UI native, or share it later.

kotlin {
    android {
        namespace = "com.example.shared"
        compileSdk = 36
    }
    iosArm64()
    iosSimulatorArm64()
    sourceSets {
        commonMain.dependencies {
            implementation(libs.kotlinx.coroutines.core)
        }
    }
}

Also covered

expect, actual and interfaces
Multiplatform libraries
Working with iOS
Compose Multiplatform

Sign in to read the rest and take the 15-question test.

Sign in to continue