gpaligot

    gpaligot

    7 months ago
    Hi here, I have a strange behavior with a model shared with an Android and iOS application. My model is:
    data class AgendaUi(val talks: Map<String, List<TalkItemUi>>)
    And I have a fake data in Kotlin too:
    val fakeAgendaUi = AgendaUi(
        talks = mapOf(
            "10:00" to arrayListOf(fakeTalkItem, fakeTalkItem),
            "11:00" to arrayListOf(fakeTalkItem, fakeTalkItem),
            "12:00" to arrayListOf(fakeTalkItem, fakeTalkItem),
        ),
    )
    The usage of this fake data work fine on Android but when I use this fake data instance on iOS, I receive a Dictionary with the good key and a list of two
    NSNull
    elements. But if I create the fake data in Swift, everything work fine:
    let agenda = AgendaUi(
        talks: [
            "10:00": [TalkItemUiKt.fakeTalkItem, TalkItemUiKt.fakeTalkItem],
            "11:00": [TalkItemUiKt.fakeTalkItem, TalkItemUiKt.fakeTalkItem],
            "12:00": [TalkItemUiKt.fakeTalkItem, TalkItemUiKt.fakeTalkItem],
            "13:00": [TalkItemUiKt.fakeTalkItem, TalkItemUiKt.fakeTalkItem],
        ]
    )
    Somebody know why? A bug in interoperability maybe?
    m

    mkrussel

    7 months ago
    It's that the initialization in Kotlin native between
    fakeAgendaUi
    and
    fakeTalkItem
    is not well defined. I think there is a fix for this coming soon, but I cannot remember where I saw details about it.
    gpaligot

    gpaligot

    7 months ago
    Thanks @mkrussel for the link to the issue!