0Pricing
Kotlin Multiplatform Academy · Lesson

Inject Platform Implementations

Provide the right actual via Koin or factories.

Who Supplies the Real Thing

An interface defines a capability, but something must hand shared code the real platform implementation. That wiring is dependency injection.

Avoid new in Shared Code

Shared logic should not construct platform classes itself. Instead it receives the implementation from outside, keeping it decoupled and testable.

All lessons in this course

  1. Design a Capability Interface
  2. expect/actual for Device Info
  3. File System & Paths per Platform
  4. Inject Platform Implementations
← Back to Kotlin Multiplatform Academy