Hello, I am using moko kswift with `SealedToSwiftE...
# multiplatform
r
Hello, I am using moko kswift with
SealedToSwiftEnumFeature
but apart of generating sealed classes from my shared module it generates bunch of additional enums from ktor, kotlinx-serialization and kodein. All the dependencies for these libraries are defined with
implementation(...)
method, and non of its classes are part of the public interface of the module. They got added even when not defined in my shared module but in one of its dependencies which again are added with
implementation(...)
and are NOT exported. Is there any easy way to disable generation of these unwanted enums?
I know there is:
Copy code
kswift {
    install(dev.icerock.moko.kswift.plugin.feature.SealedToSwiftEnumFeature) {
        filter = includeFilter("ClassContext/moko-kswift.sample:mpp-library-pods/com/icerockdev/library/UIState")
    }
}
but what would be the syntax to include only classes from my shared module?
ok for now I came up with this very elegant solution:
Copy code
class MySealedToSwiftEnumFeature(
    private val sealedToSwiftEnumFeature: SealedToSwiftEnumFeature
) : ProcessorFeature<ClassContext>() {
    override val featureContext: KClass<ClassContext>
        get() = sealedToSwiftEnumFeature.featureContext
    override val filter: Filter<ClassContext>
        get() = sealedToSwiftEnumFeature.filter

    override fun doProcess(featureContext: ClassContext, processorContext: ProcessorContext) {
        if(featureContext.clazz.name.startsWith("com/radoair")) {
            sealedToSwiftEnumFeature.process(featureContext, processorContext)
        }
    }

    companion object : Factory<ClassContext, MySealedToSwiftEnumFeature, SealedToSwiftEnumFeature.Config> {
        override fun create(block: SealedToSwiftEnumFeature.Config.() -> Unit): MySealedToSwiftEnumFeature {
            val config = SealedToSwiftEnumFeature.Config().apply(block)
            return MySealedToSwiftEnumFeature(SealedToSwiftEnumFeature(featureContext, config.filter))
        }

        override val featureContext: KClass<ClassContext> = ClassContext::class

        @JvmStatic
        override val factory = Companion
    }
}