A Greeting Function in commonMain
Write your first cross-platform Kotlin function.
Meet commonMain
Code you put in commonMain is shared by every platform. It is the heart of KMP, so this is where your first function will live.
Pure Kotlin Only
Inside commonMain you write pure Kotlin with no Android or iOS imports. If it compiles here, it runs the same on both apps.
All lessons in this course
- A Greeting Function in commonMain
- Call Shared Code from the Android App
- Call Shared Code from the iOS App
- Change Once, See It on Both Apps