https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

Dmitry Stakhov

03/07/2024, 10:44 AM
Hello guys If I use the
transitiveExport = true
configuration in umbrella module cocoapods seting up, the KMP plugin generates the ObjC classes as they are named in Kotlin:
Copy code
__attribute__((swift_name("Classname")))
but if I remove exporting transitives, the class name in ObjC is being changed and has a module prefix now:
Copy code
__attribute__((swift_name("ModulenameClassname")))
Is there a way to avoid adding module prefix, while also removing transitive export?
m

Michael Krussel

03/07/2024, 12:16 PM
I get the simple `swift_name("Classname") on my classes without the transitive export. Is the class that is got a new Swift name, in the module that that is creating the framework? If not is the dependency for it included in the list of exports?
d

Dmitry Stakhov

03/07/2024, 4:59 PM
There is an umbrella gradle module with
cocoapods {
block and there are few gradle modules that contain classes. The dependency for other modules is included using export like this:
Copy code
cocoapods {
        name = "UmberllaModule"
        version = "1.0"
        ios.deploymentTarget = "12.0"
        framework {
            baseName = "UmberllaModule"
            isStatic = false
            export(projects.module1)
            export(projects.module2)
            // transitiveExport = true
        }
}
m

Michael Krussel

03/07/2024, 6:30 PM
And the class you are looking at are in module1 or module 2 and not a dependency of them?
d

Dmitry Stakhov

03/08/2024, 4:50 AM
I guess I understand what you mean. To be more precise, It's like this: Umbrella module:
Copy code
framework {
   export(projects.module1)
   // transitiveExport = true
}
module 1:
Copy code
sourceSets {
    commonMain.dependencies {
        api(projects.module2)
    }
}
The classes that have the domain prefix now are placed in module 2 (that is added in module 1)
m

Michael Krussel

03/08/2024, 12:58 PM
If you add the export of module2 in that case the domain prefix should go away. The prefix is added to types that are not exported.
👍 1
2 Views