Detailed Explanation
Kotlin Multiplatform allows sharing code across platforms using expect/actual declarations for platform-specific implementations.\n\n**Project structure:**\n\nsrc/\n├── commonMain/kotlin/ # Shared code\n├── androidMain/kotlin/ # Android-specific\n├── iosMain/kotlin/ # iOS-specific\n├── jvmMain/kotlin/ # JVM-specific\n└── jsMain/kotlin/ # JavaScript-specific\n\n\n**Expect declarations (common module):**\n\n// commonMain/Platform.kt\nexpect class Platform() {\n val name: String\n val version: String\n}\n\nexpect fun getCurrentTimeMillis(): Long\n\nexpect object Logger {\n fun log(message: String)\n fun error(message: String, throwable: Throwable?)\n}\n\nexpected class DatabaseDriver {\n expect fun connect(url: String)\n expect fun query(sql: String): List
Share Your Thoughts