Hello everyone. I'm having a difficult time provid...
# multiplatform
a
Hello everyone. I'm having a difficult time providing my iOS counterparts the information on how to use the classes and methods I (as an Android dev) develop in the module that I export to them. Unfortunately the kDoc does not get exported for some reason and I thought I could try generating a documentation based on them. My question is ... is there a simple documentation generator based on the kotlin code? i.e. tell it to create a documentation, preferably only for, all public classes and methods and export it as ... html or markdown or ... anything ! Is there such a tool out there ?
f
You can enable KDoc export using a
-Xexport-kdoc
flag
a
hmm ... this sounds promising. any chance for a link so i better understand ?
aaah.
image.png
i see it's experimental though ...
f
Yeah, better than nothing 🤷
a
so just add this to the shared modules build.gradle.kt and when it generates the xcframework it'll export the kdocs as well ?!
is it that simple ?!
hmm, i'm guessing i need to replace the "main" with "commonMain" as that's the one i want to export the docs for ... 🤨
hmm, no, it throws an error ... KotlinNativeCompilation with name 'commonMain' not found .... With "main" it works, but i don't see the docs that were exported... when i load it into xcode
f
"It works for me ™️" I has been a while but I think this is the only thing I've added:
Copy code
targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java) {
    compilations["main"].kotlinOptions.freeCompilerArgs += "-Xexport-kdoc"
}
a
just FYI ... i had to update kotlin to 1.8.10 for this to work. I had 1.8.0 ... thank you very much for the help !!
d
@AndreiBogdan, you may find this helpful:

https://www.youtube.com/watch?v=j-zEAMcMcjA