When I right click on kotlin source folder in comm...
# multiplatform
m
When I right click on kotlin source folder in commonMain there is no
New
->
Package
action to create a package (which is there for jvmMain). Is there no packages concept in KMP or is it an issue with the IntelliJ?
Here’s for jvmMain
s
To my knowledge, a package in JVM is just a directory. So the new directory option in common is equivalent to the new package option in jvm.
Perhaps the Kotlin common code doesn't enforce that the declared package of a file matches the directory structure? That would explain the difference, but I'm just guessing.
m
True, it is just a directory, serving as namespaces for your code. The nice thing with creating package vs creating directory is that with package you can define for example “com.playground.app.xyz” and IDE creates the underlying folder structure for you. When creating directory in commonMain I have to manually do this for each folder 😕
b
You can create nested directories too com/playground/app/xyz will achieve the same result as new package
👍 2
I mean with new directory option
s
Thanks for that Martynas - I never knew that. I’ve been creating individual directories manually like a chump for 2 years in common modules.
👍 1