Hi, I have Serializable class and I used kotlinx.s...
# multiplatform
t
Hi, I have Serializable class and I used kotlinx.serialization, did someone know how I can use it in iOS SWIFT? I’m trying to parse JSON with the class I’d created
s
Hi,
Hi, I have Serializable class and I used kotlinx.serialization, did someone know how I can use it in iOS SWIFT?
What is “it”? Are you trying to parse JSON to Kotlin class from Swift?
t
I build multi platform library in Kotlin and now I’m trying to use it on iOS
s
You can define Kotlin function that serializes or deserializes particular Kotlin class, and then use this function from Swift.
t
I did that and then I got this error: “Instances of kotlin.Error, kotlin.RuntimeException and subclasses aren’t propagated from Kotlin to Objective-C/Swift. Other exceptions can be propagated as NSError if method has or inherits @Throws annotation. Uncaught Kotlin exception: kotlin.NotImplementedError: An operation is not implemented: Obtaining serializer from KClass is not available on native due to the lack of reflection. Use .serializer() directly on serializable class.”
s
This error contains all the required information to fix it.
Use .serializer() directly on serializable class
t
I’ll try again
can you send me an example please?