Wednesday, April 3, 2024
HomeAndroidJetpack Multiplatform Libraries: An Experimental Preview

Jetpack Multiplatform Libraries: An Experimental Preview


Written by Márton BraunDeveloper Relations Engineer

Kotlin support has been announced. Android In 2017, many developers were excited to write their code. Android Apps written in Kotlin. We’ve continuously expanded this support for the language over the years, going Kotlin-first with Jetpack libraries and documentation, and then further investing into Kotlin with Jetpack Compose. We’ve also seen the interest of the community in Kotlin’s multiplatform capabilities.

Kotlin Multiplatform Mobile by JetBrains has now entered beta. We have been testing this technology in order to determine if it allows code sharing between platforms. In Jetpack, you can now see a preview Kotlin Multiplatform library.

DataStore and Collections will both be made available to multiplatform users as an experimental preview. Because they assess several key aspects of changing an existing library to multiplatform, these libraries were chosen.

  • The Java programming language has not yet created Collections, a collection that is written in Java. AndroidJava collection APIs are implemented, but -specific dependencies.
  • DataStore was written in Kotlin and uses coroutines for both implementation and APIs. Java IO is also required. Android Platform APIs

With this preview, we’re looking for your feedback about using these Jetpack libraries in multiplatform projects targeting Android iOS apps. Remember that the following applications can be used for iOS and Android. Dev These builds should be considered experimental. It is not They can be used in production. These publications are released outside of the normal release cycles and are not guaranteed that they will graduate to stable.

The libraries are available from Google’s Maven repository. Add the following dependencies in your Kotlin Multiplatform program to begin using them.Get val CommonMain

val commonMain by getting {
  dependencies {
      Implementation(“androidx.collection:collection:1.3.0-dev01”)

      // APIs at lower levels that allow for serialization customization
      Implementation(“androidx.datastore:datastore-core-okio:1.1.0-dev01”)
      // APIs at a higher level for the storage of values basic types
      Implementation(“androidx.datastore:datastore-preferences-core:1.1.0-dev01”)
  }
}

Check out this sample app that uses DataStore to learn more about available APIs Android iOS or the preview API reference document available for both libraries.

You can join the Kotlinlang #multiplatform conversation to give feedback and show interest in Kotlin Multiplatform. Also, you can open bug reports on the Issue Tracker for DataStore and for Collections.

*Java is a trademark or registered trademark of Oracle and/or its affiliates.



RELATED ARTICLES
Continue to the category
- Advertisment -spot_img

Most Popular

CATEGORIES

Verified by MonsterInsights