what is the advantage of adding `file.common.kt`, ...
# multiplatform
m
what is the advantage of adding
file.common.kt
,
file.android.kt
,
file.ios.kt
in between the file name and
kt
extension?
a
if I have
src/commonMain/kotlin/MyUtils.kt
and
src/jvmMain/kotlin/MyUtils.kt
then when creating a JAR both files will compile to
MyUtilsKt.class
, so they will clash. Renaming them to
MyUtils.jvm.kt
and
MyUtils.common.kt
will avoid this problem.
m
thanks
l
It also makes it more clear which platform is which in the IDE tabs. Depending on project structure, it doesn't always show the *Main path, so you have to guess which MyUtils.kt is which. By adding the suffix, it's immediately obvious.