Why is @Parcelize documented on the android docs but not on the official Kotlin docs?
z
zsmb
08/05/2024, 7:21 AM
It's an Android-specific plugin. Other platforms don't work with parceliing.
☝️ 1
v
Vladimir
08/05/2024, 7:41 AM
Ah, what confuses me is that it is imported from kotlinx and not some android specific lib which led me to believe it had wider application
g
gildor
08/07/2024, 8:46 AM
It's because Parcelize moved to Kotlin repo to simplify support of compiler plugin, so it kinda split between Kotlin (where code and support is) and Android (the only application of it)
Well, the use case was to allow saving state of an app on iOS as well, while keep using native Parcelize+Parcelable on Android. So I KMP-fied a bunch of interfaces and annotations, typealiased them to Parcelize/Parcelable on Android, and then created a compiler plugin for Darwin targets that generates the code and relies on NSSecureCoding. Until all of a sudden things broke in K2. That issue was eventually fixed, but I didn't have time to update parcelize-darwin because I already migrated all my libs to kotlinx-serialization.