# Koin Annotations Make expect/actual Obsolete in KMP

DevFeed: [Koin Annotations Make expect/actual Obsolete in KMP](<https://devfeed.tech/articles/koin-annotations-make-expect-actual-obsolete-in-kmp-22971.md>)

Original publisher: [Read original article](<https://blog.insert-koin.io/koin-annotations-make-expect-actual-obsolete-in-kmp-5f1445e2055e?source=rss----925561f2ecdf---4>)

Author: Tezov

Published: 2026-06-11T08:48:59Z

Content type: tutorial

Language: en

Sources: [Koin developers - Medium](<https://devfeed.tech/sources/koin-developers-medium.md>)

Topics: [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [compose-multiplatform](<https://devfeed.tech/topics/compose-multiplatform.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [cross-platform](<https://devfeed.tech/topics/cross-platform.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [compose-multiplatform](<https://devfeed.tech/tags/compose-multiplatform.md>), [cross-platform](<https://devfeed.tech/tags/cross-platform.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [development](<https://devfeed.tech/tags/development.md>), [interface](<https://devfeed.tech/tags/interface.md>), [kmp](<https://devfeed.tech/tags/kmp.md>), [koin](<https://devfeed.tech/tags/koin.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlinmultiplatformmobile](<https://devfeed.tech/tags/kotlinmultiplatformmobile.md>)

## AI overview

A tutorial showing how Koin annotations and the Koin compiler can replace expect/actual declarations in Kotlin Multiplatform projects. It defines shared interfaces in commonMain, provides Android and iOS implementations through dependency injection, and uses Compose Multiplatform to resolve the platform-specific behavior.

## Source excerpt

Source code available at the end of the article In Kotlin Multiplatform (KMP) projects, expect/actual is traditionally used to handle platform-specific implementations. In a previous story, I showed how to reduce expect/actual to only one per module using Koin DSL. Today, we can go further. With Koin annotations and the Koin compiler, you can completely bypass expect/actual. This method works seamlessly with Compose Multiplatform and lets you maintain a clean architecture while keeping platform-specific logic where it belongs. Previous Story Mastering Koin Annotations with the Koin Compiler Through Unit Tests -> link Next Story I don't know yet-> coming soon Setting the Stage Inside commonMain, Koin is initialized like this: @Module @ComponentScan( "com.tezov.store.shared.di", "com.tezov.store.shared.data", "com.tezov.store.shared.domain", "com.tezov.store.shared.presentation" ) class SharedModule @KoinApplication(modules = [SharedModule::class]) class SharedApplication val koinConfiguration = koinConfiguration<SharedApplication> { /* nothing here for the demo */ } I'm using: koinCompiler = "0.6.2" koinCompose = "4.2.1-RC1" koinComposeAnnotation = "4.2.1-RC1" The important part here is the @ComponentScan. Koin doesn't just scan commonMain. It also scans the platform modules: androidMain and iosMain. That detail is key because it lets Koin find all implementations without any manual wiring. Defining Contracts in commonMain Instead of expect, we define interfaces for domain and presentation layers. Domainpackage com.tezov.store.shared.domain interface PlatformDomainProtocol { fun description(): String }Presentationpackage com.tezov.store.shared.presentation import androidx.compose.runtime.Composable interface PlatformPresentationProtocol { @Composable fun ComposableFromPlatform() } Yes, you can even include a @Composable in an interface. This is powerful: your shared code can remain clean while delegating platform-specific behavior entirely to the DI container. When usi