Multiplatform Kotlin Library Development

Developing a multiplatform Kotlin library allows for sharing code across Android, iOS, JavaScript, and Kotlin Native platforms, with strategies including wrapping platform APIs and creating a shared interface for common code.

Key takeaways
  • The concept of multiplatform development allows for sharing code across various platforms, including Android, iOS, JavaScript, and Kotlin Native.
  • Libraries can be developed to be platform-agnostic, with implementations for each platform.
  • Wrapping platform APIs can be a strategy for multiplatform development.
  • Editing and updating settings can be a key aspect of multiplatform development.
  • Java properties API does not actually do what it says, and a custom implementation is needed.
  • Android shared preferences has a listener API for shared preferences change notifications.
  • JavaScript and Native platforms require different implementations for the settings library.
  • Creating a shared interface for common code can be beneficial.
  • Expect actual is a tool in Kotlin that allows for a one-to-one mapping of platform-specific code.
  • Testability is important for multiplatform development and libraries can be written to be testable.
  • Coroutines, serialization, and Ktor client are important topics in Kotlin development.
  • The author has been working on a library called multi-platform settings and has learned several lessons along the way.
  • Lessons include the importance of platform-specific code, managing complexity, and the value of community feedback.
  • Creating a draft for a library can be beneficial in gaining feedback and iterating on the library.
  • The author is now working on a new project combining Kotlin multiplatform and Azure Pipelines.