Hi All, Since Kotlin 1.4, the automatic translati...
# multiplatform
m
Hi All, Since Kotlin 1.4, the automatic translation of suspend methods is making our iOS API fail with ambiguous methods. That is because we've defined an interface with a suspend method, for use in Kotlin, and 2 special overloads with callback/completions for Jvm(Android) and iOS. The suspend method and iOS specific method are marked with
@JvmSynthetic
to hide them from the JVM API. I am now wondering if there is similar annotation to make methods hidden from the iOS (Objective-C) API, so I can hide the suspend method, effectively disabling the automatic conversion.
s
Not sure if this can be done in your code’s design, but you could use an
expect
and different `actual`s. The
actual
for iOS won’t have that suspend method, while the one for Android will have it.
m
We tried that before, and we get this incredibly complex set of expect/actual interfaces and impls, which is really hard to maintain. I'd rather not go back to that situation. For now I've fixed it with renaming all the suspend methods from
doSomething()
to
doSomethingSuspended()
so that we at least get rid of the ambiguous methods in iOS. The auto-translated suspend methods are still there, but now have a different name. Downside is that the Kotlin API has the
Suspended
suffix added to it everywhere.