How can I use the `Preview` annotation in build 24...
# compose-desktop
a
How can I use the
Preview
annotation in build 245 ?
r
You need to install this plugin as well
a
yeah I have it
r
You also need to add the uiTooling dependency
a
oh it was that, thanks !
does preview exists on IJ ?
r
Yes for compose desktop. In fact I do all my android UI development inside compose desktop because it is faster.
a
How do I use it on Intellij, I don't find it 🤔
a
ah okay it needs no arguments
j
Did you add it in the desktop module/sourceset or common module/sourceset? The dependency must be added to the desktop source set and can only be used from whichever source set you add it to (your desktop one)
a
I tried to add previews to the TodoApp's
compose-ui
module, which is a KMP module with
jvm
and
android
targets. The UI is in the
commonMain
source set. https://github.com/JetBrains/compose-jb/tree/master/examples/todoapp/common/compose-ui
j
Right, what I'm saying is that your preview annotations can't be in the commonMain source set. They need to be in the desktop/jvm source set. You can define a new file in your desktop/jvm source set or add them here: https://github.com/JetBrains/compose-jb/blob/master/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt
a
Thanks Jim for your help, I'll will do.