Skip to content

expect/actual

expect/actual 是 Kotlin 多平台项目中用于实现平台特定代码的核心机制。它允许我们在共享代码中声明 API 契约(使用 expect 关键字),然后在各个平台特定代码中提供实现(使用 actual 关键字)。

Egloo 中Kotlin 多平台中的 expect/actualKotlin 多平台中的 expect/actual - 掘金

Leveraging expect/actual in Kotlin Multiplatform for Native Implementations – Carrion.dev

亲手创建自己所需的软件,是程序员的幸运。