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?
Marcin Bak
09/29/2020, 9:20 PM
Here’s for jvmMain
s
Shawn Witte
09/29/2020, 9:25 PM
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.
Shawn Witte
09/29/2020, 9:27 PM
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
Marcin Bak
09/29/2020, 9:39 PM
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
Big Chungus
09/29/2020, 9:42 PM
You can create nested directories too com/playground/app/xyz will achieve the same result as new package
👍 2
Big Chungus
09/29/2020, 9:59 PM
I mean with new directory option
s
spierce7
09/30/2020, 4:14 AM
Thanks for that Martynas - I never knew that. I’ve been creating individual directories manually like a chump for 2 years in common modules.