Radoslaw Juszczyk
01/06/2023, 3:14 PMSealedToSwiftEnumFeature
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?Radoslaw Juszczyk
01/06/2023, 3:18 PMkswift {
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?Radoslaw Juszczyk
01/06/2023, 3:37 PMclass 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
}
}