According to <https://github.com/JetBrains/kotlin-...
# kotlin-native
j
According to https://github.com/JetBrains/kotlin-native/blob/master/OBJC_INTEROP.md -> Function types every callback requires returning a KotlinUnit instance, like this:
Copy code
ApiExample().exampleRequest(machine: machine) { response, exception in
   return KotlinUnit()
}
When one wants to distribute a library to 3rd party devs requiring the dev to return a KotlinUnit on every callback has a bad smell attached to it. Is there any plans to change this behaviour?
👍 2
o
unfortunately, this is design issue common to Unit semantics in Kotlin, see https://stackoverflow.com/questions/37828790/why-do-i-have-to-return-unit-instance-when-implementing-in-java-a-kotlin-functio for similar problem in Java interop
s
See also the following discussion: https://github.com/JetBrains/kotlin-native/issues/1271 Kotlin and Swift are different languages. It is the fundamental reason for cases like this, when idiomatic Kotlin API translated to not-so-idiomatic Swift API.
j
okay, thank you for the resources.