icerockdev / moko-kswift

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

Enhancement: Generate extensions over primitive types #22

Closed PStrelchenko closed 2 years ago

PStrelchenko commented 2 years ago

Plugin version I've used

plugins {
    id("dev.icerock.moko.kswift") version "0.3.0"
}

Problem

If we define extension function over, e.g. String type in Kotlin, this function will not be translated as an extension in Swift:

// StringExt.kt

val String.myExtensionProperty: String get() = "123"
fun String.myExtensionFunction() { ... }

private fun example() {
    val result = "123".myExtensionProperty
    "123".myExtensionFunction()
}

moko-kwift didn't handle this issue, because extension function didn't pass the filter =)

It would be great if moko-kswift will generate extensions in such case.

Alex009 commented 2 years ago

will be available in 0.4.0