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

rudolf.hladik

06/09/2021, 4:50 PM
Hi everyone, is there a way to modify generated swift name of Kotlin class? the usecase is I have a
open class SomeOpenClass
in my library named e.g.
MyKmmLibrary
if the user use it in the kmm app the open class will have the swift name
MyKmmLibrarySomeOpenClass
which is terrible, is there a way to force it to be named just
SomeOpenClass
?
k

Kris Wong

06/09/2021, 4:54 PM
K/N already does this for you
r

rudolf.hladik

06/09/2021, 4:55 PM
so it is not possible to change it?
k

Kris Wong

06/09/2021, 5:12 PM
not to my knowledge
e

ephemient

06/09/2021, 6:33 PM
k

Kris Wong

06/09/2021, 6:37 PM
that would just change the prefix, not the class name
e

ephemient

06/09/2021, 6:44 PM
https://kotlinlang.org/docs/apple-framework.html says framework name is used as the prefix there too
t

Tijl

06/09/2021, 7:17 PM
transitiveExport = true
will use just the plain name (no prefixes), but as the name suggest, it will export all your
api
dependencies too
👍 1
b

borisdamato

06/10/2021, 9:51 AM
If you export the dependency when you build the framework it should get rid of the prefix: https://kotlinlang.org/docs/mpp-build-native-binaries.html#export-dependencies-to-binaries
👍 1
3 Views