I'm lost, even compilation doesn't work (so it's n...
# compose-desktop
n
I'm lost, even compilation doesn't work (so it's not yet another Intellij Idea bug)... It's the same code as the "example" project. What am I missing ?
a
Android Studio has a quick fix for this when I hit alt+enter, but IntelliJ doesn't 😞 But you can change
import androidx.compose.runtime.remember
to
import androidx.compose.runtime.*
and it should work (also if you organize imports afterwards) the problem is missing imports for
getValue
and
setValue
n
Wooow that bad lol I checked the import but not the .getValue and .setValue import. That's really bad lol Thanks a lot. I will step away from Compose yet another year I guess ^^
m
I mean, all you have to do is add these two imports and you're good to go. And that's really only an issue with IJ that it's not always suggesting those automatically.
n
Yes the issue is from Compose. This is the kind of magic stuff I don't want to deal with when coding a GUI
a
It's annoying in IntelliJ, but not that big of a deal for me
n
I spent 1 hour on a import problem. What year is it ? 😄
a
m
It's not so much about Compose, they just happen to use delegated properties as an extension functions (like this one:
inline operator fun <T> State<T>.getValue(thisObj: Any?, property: KProperty<*>): T = value
), so that you can use
State
objects with the
by
notation. And all extension functions require and import. It's just standard kotlin, other libs or you too can do it. So if anything it could be viewed as a problem in the design of Kotlin itself, but then I don't know how to handle it better.
a
I just upgraded to 2022.2.3 and it works! Thanks for giving me the motivation to check this 😄