https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

Sylvain Patenaude

01/23/2020, 7:41 PM
I have a function returning
Array<String>
in Kotlin Multiplatform. Is this specific type consumable from Swift? If so, what is the equivalent type in Swift? EDIT: Looks like it's
KotlinArray
in Swift. EDIT2: Well, looks like
KotlinArray
is a generated type from my framework itself. I wonder if I shouldn't use
List<String>
instead of
Array<String>
? Would it then translate into the desired type in Swift (which would be
[String]
I guess)?
a

Artyom Degtyarev [JB]

01/24/2020, 8:03 AM
Yes, Kotlin’s
List
should be translated to Swift’s
Array
. To learn more on mappings, see (https://github.com/JetBrains/kotlin-native/blob/master/OBJC_INTEROP.md#mappings)
s

Sylvain Patenaude

01/24/2020, 2:52 PM
Yeah, saw that also on the kotlinlang.org site. But they don't mention Kotlin's
Array
though. I used arrays at a lot of places in my functions (either parameters or return type). Most notably
UBbyteArray
. I hope I don't have to change to
List<UByte>
... 🤨😬
3 Views