icerockdev / moko-kswift

Swift-friendly api generator for Kotlin/Native frameworks
https://moko.icerock.dev
Apache License 2.0
348 stars 21 forks source link

Generate code for extension with lambdas #85

Open radimjanda754 opened 1 year ago

radimjanda754 commented 1 year ago

I would like to generate swift code for following extension:

fun ExceptionData.blockingError(
    onLoginClicked: (() -> Unit)? = null,
    onRegisterClicked: (() -> Unit)? = null,
    onRetryClicked: () -> Unit,
) : BlockingError

However the plugin generates lambdas as Function0 which doesn't work.

public extension shared.ExceptionData {

  @discardableResult
  public func blockingError(
    onLoginClicked: Function0<Void>,
    onRegisterClicked: Function0<Void>,
    onRetryClicked: Function0<Void>
  ) -> BlockingError

Could it be possible to properly generate code for lambdas?