moko-resources
moko-resources copied to clipboard
Compatiblity issues with K2 compiler
https://youtrack.jetbrains.com/issue/KT-60437/K2-problem-with-Parcelable-plugin https://youtrack.jetbrains.com/issue/KT-59480/K2-build-moko-resources
Looks like there is no way to use Parcelable in KMM anymore. Probably need to remove all Parcelable related feature to make it work in K2 compiler
or it is better to move to Java serializable class. it will still work in K2 compiler because it doesn't need annotation, code generation, ksp
We can use kotlinx-serialization I guess @sanjeevirajm
@moffpage Java serialisation and Parcelable has a major advantage -
- bundle.putSerializable()/putParcelable() - it will just keep the object reference in memory and will do actual serialization only when activity has went to onStop state
- bundle.putString(convertObjectToStringUsingKotlinxSerialization()) - will do serialization even before it is needed
Maybe it's true idk, just a suggestion because there's another developer (Googler), that maintains a set of KMP libraries; he changed the implementation of some of the details in one of his library from Parcelable to Kotlinx.Serialization
Moko-resources runtime could potentially implement kotlinx.serialization annotations and the end user could use https://github.com/chRyNaN/serialization-parcelable. It uses original Parcel instance for encoding/decoding, so there would not be problem, described by @sanjeevirajm above. Fix me if i'm wrong)
Alternative from Jetbrains - Compose multiplatform beta now supports string resource sharing. https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.6.0-beta01
fixed in 0.24.0-beta-1