Skip to main content

Command Palette

Search for a command to run...

03 - Shared Module Architecture: expect/actual, Interfaces and Dependency Injection

The expect/actual mechanism in Kotlin allows declaring an API in common code and providing platform-specific implementations for each target without b

Published
1 min readView as Markdown
F
Love coding and AI

The expect/actual mechanism in Kotlin allows declaring an API in common code and providing platform-specific implementations for each target without breaking encapsulation. Combined with Koin for multiplatform dependency injection, shared logic can be tested in isolation.

What you'll learn

  • Architettura a layer per il modulo condiviso: domain, data, presentation
  • expect/actual: pattern corretti e anti-pattern da evitare
  • Interfacce per isolare dipendenze platform-specific
  • Koin per dependency injection multiplatform
  • Testing del modulo condiviso in isolamento

This article is part of the Kotlin Multiplatform series on federicocalo.dev.


Read the full article

The complete article (13 min read) with code examples, diagrams, and practical exercises is available here:

➡️ 03 - Shared Module Architecture: expect/actual, Interfaces and Dependency Injection

https://federicocalo.dev/en/blog/kmp-shared-module-expect-actual-dependency-injection


By Federico Calò — Software Developer & Technical Writer