Get the Platform Name per Target
A classic expect/actual function for Android and iOS.
The Hello World of KMP
Returning the platform name is the classic first expect/actual you write. It proves your shared module really runs on both apps. 👋
Declare the expect
Start in commonMain with an expect function that returns a String. No body yet, just the shape both platforms agree on.
expect fun platform(): StringAll lessons in this course
- Why expect/actual Exists
- Get the Platform Name per Target
- expect/actual Classes & Properties
- Common Mistakes & Compiler Errors