Hello! Fast question. It's possible to use Kotlin ...
# multiplatform
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