Skolson5903
01/24/2022, 11:40 PMsuspend fun anyname(arg1:String, block: suspend (arg) -> Unit)
. What is the best way to invoke this from swift? I'm watching some unresolved issues in Youtrack (https://youtrack.jetbrains.com/issue/KT-47610 ) on making this better, but with current swift and kotlin 1.6.10 am having trouble figuring out if there is a non-messy way to do this. Specifically the best way to code the block
lambda above in the Swift call of anyname("xxx") { arg -> ... }
. I'm currently playing with using a class that implements the kotlin-generated swift protocol KotlinSuspendFunction1
which has an invoke
function that is getting called with arg1: Any? and a completionHandler. Is that the best/only way to make this work, or am I going down a rabbit hole since I'm a Swift newbie? If anyone can point me to an example of doing this better, I'd appreciate it. I guess the real answer I'm asking for is whether this is even a good thing to try to do from Swift until it gets improved 🙂. Thanks in advance for any tips/links.ephemient
01/24/2022, 11:50 PMSkolson5903
01/24/2022, 11:51 PM