expect-actual

Installation
SKILL.md

expect/actual Pattern for KMP

The expect/actual declaration is Kotlin's mechanism for writing platform-specific implementations while maintaining a shared API surface.

Core Concept

// shared/commonMain/kotlin/Platform.kt
expect class Platform() {
    val name: String
}

// shared/androidMain/kotlin/Platform.android.kt
actual class Platform {
    actual val name: String = "Android ${Build.VERSION.SDK_INT}"
}

// shared/iosMain/kotlin/Platform.ios.kt
actual class Platform {
Related skills
Installs
10
GitHub Stars
44
First Seen
Feb 17, 2026