Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    So maybe this is asked here already but we have an issue. All functions in our shared code marked as
    suspend
    do not show up in the compiled iOS code and cannot be called. Do we have to remove coroutine support from our shared code or is there some trick to make it work?
    kpgalligan

    kpgalligan

    2 years ago
    iOS has no concept of suspend. You need to pass a callback
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    This confuses me a bit as there is a KMP library for coroutines and no compilation errors. The functions just are missing
    ktor also uses coroutines to make calls.
    is there a nice pattern to implement a multi-platform API that calls backend with ktor
    but doesn’t use suspend in the interface
    kpgalligan

    kpgalligan

    2 years ago
    You can’t expose suspend methods to the iOS header. We just have the external method take a lambda and have Swift pass that in.
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    ok
    but you can’t use launch{} in KMP either, as far as I figured out, or?
    kpgalligan

    kpgalligan

    2 years ago
    On phone right now, but can dig up a sample in a bit
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    so how can I call Ktor.
    cool, thanks 🙂
    kpgalligan

    kpgalligan

    2 years ago
    Why can't you use launch?
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    does not compile 😕
    sigh. Maybe somethign is missing
    Larten

    Larten

    2 years ago
    You can use launch and works
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    okay, must be gradle messed up then, thanks. I’ll dig into it
    Olenyov Kirill

    Olenyov Kirill

    2 years ago
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    oh, that’s cool. Thanks!
    kpgalligan

    kpgalligan

    2 years ago
    Interesting. Never heard of these
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    These both look a bit old. Are they still active?
    kpgalligan

    kpgalligan

    2 years ago
    They’re def old. Digging a bit
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    We had an issue with older libraries that they don’t compile anymore as they were compiled by older Kotlin verison
    as an idea, these look amazing
    especially
    @Recast
    kpgalligan

    kpgalligan

    2 years ago
    Native libraries need to be updated. There look like compiler plugins, although that seems like a strange/risky place to be just now
    Got it. For “recast”, you need to use kapt to make source for iOS
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    do you feel it’s a worth a try at this stage?
    kpgalligan

    kpgalligan

    2 years ago
    The other one uses https://github.com/Foso/MpApt, which I’ve avoided, but see how it goes
    Not even close
    But that’s me
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    I’m a complete n00b stumblin in dark trying to get our lib working so I happily take in your input
    kpgalligan

    kpgalligan

    2 years ago
    I don’t find the callback scheme to be that difficult to implement, and I’d expect to spend more time on sorting out config
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    I’ll just write a wrapper into the repository that calls the suspend ones and responds in callbacks
    kpgalligan

    kpgalligan

    2 years ago
    Yeah, it’s extra “code” but not that hard to do
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    yeah, exactly. And if something breaks at least I know I did it 😄
    kpgalligan

    kpgalligan

    2 years ago
    I was going to send a sample, but then updated intellij, then got distracted…
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    Thanks. Much appreciate the expertise 🙂
    kpgalligan

    kpgalligan

    2 years ago
    What’s your github? I’ll add you to our new sample app.
    Juhani Lehtimäki

    Juhani Lehtimäki

    2 years ago
    JuhaniLehtimaeki
    thanks 🙂
    r

    ribesg

    2 years ago
    My solution is to not write any Swift code 😛
    kpgalligan

    kpgalligan

    2 years ago
    Added, but forgot we’re using Flow, not passing in callbacks to methods.