0PricingLogin
Kotlin Multiplatform Academy · Lesson

expect/actual Classes & Properties

Beyond functions: declarations you can expect/actual.

Beyond Functions

expect/actual is not limited to functions. You can also declare whole classes, properties, and even objects that differ per platform.

An expect Property

Need a value that each platform defines? Declare an expect val in commonMain and let every target supply the actual value.

expect val platformName: String

All lessons in this course

  1. Why expect/actual Exists
  2. Get the Platform Name per Target
  3. expect/actual Classes & Properties
  4. Common Mistakes & Compiler Errors
← Back to Kotlin Multiplatform Academy