Hello, I'm new to compose with a lot of (stupid) q...
# compose-desktop
f
Hello, I'm new to compose with a lot of (stupid) questions (after trying JavaFX + ControlsFX + Gradle + Kotlin on IDEA Ultimate and almost killed myself with the build processes). But first, at the moment what is the right way to create UIs? Use Android Studio to benefit from the @preview annotation then switch to IDEA when it looks ok while keeping in mind that some components are not ported yet (like RangeSlider)? (I fully understand the early stage of all those things).
j
@Preview doesn't work in desktop
f
I now but basically if I start as an Android App then copy all my UI code to my desktop project it should do the trick? Or am I going to face a dead end?
t
Keep in mind that not all things which are working on Android work for Desktop. I don't think that preview is really essential. Not sure what the current state is but in the beginning of compose the preview generation took longer than deploy the app to Android. For desktop you do not need to deploy the app. Just start it.
f
Yes, that is what I do for the moment but I have the bad habit to make a small/insignificant change and reload to look at the result (you know, like the gamers that reload their weapon because they used one bullet and end up dead because of it :P)
t
Yes i know. And this is the difference between web developers (Javascript) and Desktop/Android developers. We need to compile and wait for the result. This is the reason why the development takes 3 times longer. It would be very cool if this preview could reduce this problem a little bit.
j
Usually u will have the common code in a multiplatform module
there @preview annotation doesnt exist
message has been deleted
message has been deleted
that is the project structure, if you have luck, you can get the commonMain with 100% compose screens, so you can't preview nothing
if some screen is different in each platform, you maybe can preview it in Android, but having a mixed structure can be strange, so I think it is better to wait to preview works in all places
f
Yes indeed. It makes sense for a project outside of a simple POC.
t
I think to learn compose you can start with a android only app. Without MPP. Than you have preview. Later you can change to MPP and maybe you do not need preview so much anymore.
f
I don't really need it, I'm just lazy where I can. I started Android dev in 2013 and things are so smooth now but there was a bunch of nightmares along the way so I can't really complain too much ^^.
j
We intend to bring preview to desktop, but in the mean time, on Desktop, you can create a simple main function that just renders the one widget you want to test in a new window. Not quite as convenient as annotating the function with
@Preview
, but it works and the experience there isn't terrible. Just click the play button (or hotkey) to run your makeshift preview window.
👍 5
c
Didn't think of that, but yeah that's just as fast (if not faster) than @Preview in studio at the moment. lol
x
@Fabrice I had the same issue when I started over. But after a week hacking with Components I have a good feel on what to expect. So get your lazy out there and Reload the shit out of your app until you can @Preview in your inner eye !!
🤣 2
👍 1