Hi guys. I have a question. I’m working on a multi...
# serialization
m
Hi guys. I have a question. I’m working on a multiplatform project with a common module sharing code between Android/iOS. In the common module, I have some model classes annotated with @Serialization. With Android, everything works as is expected, but when I try to generate the library for iOS I get this error:
Copy code
> Task :common:compileKotlinIos
error: compilation failed: Can’t locate polymorphic serializer definition
(gradle 4.10.3, kotlin 1.3.20, kotlinx-serialization-runtime-native 0.9.1) There is some workaround or suggestion to fix this issue?
j
You should be able to use Mirror (https://github.com/lightningkite/mirror-kotlin) to handle polymorphic serialization on native. It's an alternative plugin to the main Kotlinx Serialization plugin.
👍 1
m
Awesome, thanks. I will try it
j
Be warned - you're probably the first person to try it besides myself. I'm happy to help - feel free to DM me.
👍 1
s
Polymorphic serializer is implemented only on JVM right now, we are working on its multiplatform version
👍 2
j
@sandwwraith Once you've got that working, I'll change out Mirror to just use the serializers from your plugin. That's awesome, just looked at the branch. Thanks!