This chapter has hopefully illustrated the interesting potential of Kotlin multiplatform to achieve code sharing between multiple targets. Kotlin multiplatform differs from other cross-platform solutions. In this, it aims to share logic and models, not UI. Because of this distinction, Kotlin multiplatform offers a lower-risk proposition when compared to frameworks such as React Native or Flutter. It is quite simple to write a small function or model in Kotlin and then share that across multiple platforms, where it can be consumed as a simple dependency.
Kotlin multiplatform projects can be configured and built via Gradle, making it easy to define various build targets and then generate any required build artifacts. Within a Kotlin multiplatform project, implementations can be shared across all platforms, or they can be customized based on each platform using the expect...