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
- Design a Capability Interface
- expect/actual for Device Info
- File System & Paths per Platform
- Inject Platform Implementations