Hi! Will the swift interop releases this year impr...
# swift-export
d
Hi! Will the swift interop releases this year improve the naming of kotlin top level functions? so that you don't need to use something like this: Filename_iosKt.myFunctionCall() ?
s
Hi! What would you consider by improvement? :)
d
I'm not sure yet what would be the ideal alternative since Swift does not support top level extensions, but maybe NameOfLib.myFunctionCall()?
s
The problem here is that in Kotlin declarations usually stored inside packages (e.g.
package org.foo.bar
). So in a single module
KotlinModule
you might have:
Copy code
// File A.kt
package org.foo.bar

fun action()

// File B.kt
package org.foo.baz

fun action()
So you can directly call
KotlinModule.action()
on a Swift side because you don't know which
action
should be called. Sucks, I know. Our current approach is to give users a way to say: "in my library package
org.foo.bar
is the default one, so please collapse it in the generated Swift API". This way you will be able to call
KotlinModule.action()
on a Swift side and it will resolve into
org.foo.bar.action()
. And you still going to be able to call another one by using fully-qualified name
<http://KotlinModule.org|KotlinModule.org>.foo.baz.action()
.
🙏 1