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

Paul Weber

01/05/2022, 9:58 PM
Swift offers the possibility to omit argument names when calling a function if the function is declared like
func foo(_ arg: Bar) {}
. I.e., you can just
foo(myArg)
instead of having to
foo(arg: myArg)
It’s probably not possible to declare a function in kotlin that behaves the same way at the swift callsite, right?
r

russhwolf

01/05/2022, 10:04 PM
The only scenario I'm aware of where you can do this is extension functions which (assuming they don't come through as Swift extensions) end up looking like
func foo(_ receiver: Bar)
e

ephemient

01/05/2022, 10:06 PM
Kotlin interoperates with Objective-C, so I suppose this could theoretically be possible by tweaking the Objective-C signature. I don't think it's possible in Kotlin/Native now, though.
r

russhwolf

01/05/2022, 10:08 PM
Yeah they could definitely add an annotation or something to control this, but it doesn't exist now. Just like the lack of
@JvmName
and
@JvmOverloads
analogs in native
2 Views