eygraber
07/26/2022, 2:37 PMvararg String
is there any way to have that use a variadic function instead of KotlinArray
on iOS?
I imagine no because the vararg is an array, but I'm wondering if anyone has any ideas.
My iOS team doesn't want to use KotlinArray
so I'm providing a Set<String>
overload for them, but it's not ideal.Jeff Lockhart
07/26/2022, 3:14 PMKotlinArray
and calls the Kotlin function. I've done this in a few places to smooth out the Swift API with extension functions.Jeff Lockhart
07/26/2022, 3:18 PMstatic func
extensions which call KotlinClass.companion
, until something similar to @JvmStatic
for native is available.Jeff Lockhart
07/26/2022, 3:21 PMSwift.Array.toKotlinArray()
extension used in these other variadic extensions:
extension Swift.Array where Element: AnyObject {
func toKotlinArray() -> KotlinArray<Element> {
KotlinArray<Element>(size: Int32(count)) {
self[$0.intValue]
}
}
}