Is there a simple way to pass a Swift `[String]` t...
# kotlin-native
r
Is there a simple way to pass a Swift
[String]
to a Kotlin function taking an
Array<String>
(exposed to Swift as
KotlinArray<NSString>
)?
s
If you change your kotlin function signature to List<String>, I believe it will bridge automatically.
r
That’s what I did but that’s not the question 😄
s
I suspect its a limitation in the toll free bridging the ObjC runtime does between types. You might be able to write an extension in Swift that would copy the array into a KotlinArray that you instantiate from Swift. It’s a terrible idea but it should work. There’s probably a reason the JB devs didn’t setup Kotlin arrays to bridge as NSArrays but I don’t know what that is.
r
Yeah I really just thought I missed something obvious so I asked. But no I think
List
is the only answer. It was for a
main
function so supposedly
Array<String>
was the only solution but oh well, it works. My Kotlin main just isn’t a real main anymore, sadge