0Pricing
Kotlin Multiplatform Academy · Lesson

Design a Capability Interface

Define a shared contract for a platform feature.

Some Things Are Platform-Only

Reading the battery level or device model is different on Android and iOS. Shared code still needs a clean way to ask for it. 🔋

Start With the Need, Not the API

Design from what your app actually needs. A simple interface states the capability in plain Kotlin, hiding every platform detail.

interface BatteryInfo {
  fun level(): Int
}

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