Hello! Fast question. It's possible to use Kotlin reflection in Kotlin Multiplatform? Only from comm...
f
Hello! Fast question. It's possible to use Kotlin reflection in Kotlin Multiplatform? Only from common module, not on iOS or Android. Building at this moment a wrapper over Firebase Firestore and I want to cast a convert a class to a
Map<Field,Value>
for pass it to iOS library.
g
No, reflections are available only on JVM
But probably kotlinx.serialization may help somehow in your case
f
Gonna check that then
g
Iโ€™m not sure about particular approach, and itโ€™s not exactly how it works, but it created to generate bytecode that provides mapping function for serialization formats (so probably output maybe also Map)
f
Great, gonna investigate about it ๐Ÿ™‚ If it works as common serialization it should not be really hard. My other approach was going to have a
Serializable
interface applied to the models with a
toMap
fromMap
methods ๐Ÿ˜…
So if this works it will save me a lot of boilerplate ๐Ÿ˜„ thank you so much @gildor