I use K/N module (CoreModule) in my Android/IOs pr...
# kotlin-native
a
I use K/N module (CoreModule) in my Android/IOs project. That module is depends on another MPP module (CommonModule), so I use this code in my gradle-file to make classes from CommonModule be visible in the swift code:
Copy code
binaries {
                framework('CoreModule') {
                    export project(":CommonModule")
                }
            }
Now I'm trying to migrate to the new CocoaPods Gradle plugin but receive a
Use of undeclared type '<class>'
error for classes from CommonModule. I've tried to apply cocoapods plugin to CommonModule and import both frameworks to swift files but it didn't help - I got 2 versions of each of CommonModule's classes that are incompartible between each other. Is there any analogue for
export(project(":exported"))
instruction in the new CocoaPods Gradle plugin?
I managed to resolve most of compile errors by adding
typealias <class> = Commonmodule<class>
instructions. But I some classes still can't be found in swift - they are
object
and
companion object
in a
sealed class
.
m
I think the problem is that you create a new framework called
CoreModule
in Gradle instead of configuring the default created framework. The result is probably two frameworks: The one which CocoaPods links into the Xcode project and another one which has the export and isn't linked at all. I do something along these lines:
Copy code
listOf(DEBUG, RELEASE).forEach { buildType ->
	getFramework(buildType).apply {
		baseName = "CoreModule"
		isStatic = false

		export("com.github.fluidsonic:fluid-stdlib-$dependencySuffix:0.9.21")
		export("com.github.fluidsonic:fluid-time-$dependencySuffix:0.9.10")
		export("io.ktor:ktor-http-$dependencySuffix:1.2.1")
	}
}
(
dependencySuffix
in my case is the platform, e.g.
ios64
)
1
a
Thanks for your reply but it didn't help - I resolved this issue by adding wrapper functions in CoreModule.