Aditya Kurkure

    Aditya Kurkure

    6 months ago
    Can I pass a function
    (UIBackgroundFetchResult) -> void
    from swift to Kotlin? Currently the method I have written in kotlin expects a
    (UIKUIBackgroundFetchResult) -> void
    when called from swift.
    s

    Sebastien Leclerc Lavallee

    6 months ago
    I did a quick test, and yes you can do that. I had a function like:
    fun doSomething(with: String, completion: (Time) -> Void) { }
    And it was callable from Swift code without problem
    Aditya Kurkure

    Aditya Kurkure

    6 months ago
    Thanks. I still have the problem of swift expecting a
    UIKUIBackgroundFetchResult
    instead of UIBackGroundFetchResult though.
    s

    Sebastien Leclerc Lavallee

    6 months ago
    Oh I see… sorry I didn’t understand the question 😅 My bad. So on the Swift side it’s called
    UIBackgroundFetchResult
    but KMM translate it to
    UIKUIBackgroundFetchResult
    🤔 Hum… considering they are basically the same but with different names, I would cast the UIKUI version to UI. But this would need to be done on the Swift side.
    Aditya Kurkure

    Aditya Kurkure

    6 months ago
    Just tried this. Unfortunately it doesn't work.