Thread
#multiplatform
    f

    FranGSierra

    2 years ago
    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.
    gildor

    gildor

    2 years ago
    No, reflections are available only on JVM
    But probably kotlinx.serialization may help somehow in your case
    f

    FranGSierra

    2 years ago
    Gonna check that then
    gildor

    gildor

    2 years ago
    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

    FranGSierra

    2 years ago
    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