Thread
#compose
    Colton Idle

    Colton Idle

    1 year ago
    I feel like I know the answer to this question... but I'm going to ask it anyway. Iterating on a Composable and viewing the Preview in a new project is much faster (still not blazing fast) but definitely faster than a large existing project that I already have where we just added compose. Is it possible to just have an @Preview not have to rebuild the full project if the full project is needed? I realize it's probably easier said than done, but something like this
    @Preview(showBackground = true)
    @Composable
    fun Beep(){
        Text("Boop")
    }
    is just interesting that it takes like 5 minutes in my old project (because my existing project is super large it just builds slow overall) vs in a brand new project. What am I actually after? I want to be able to create and iterate on composables quickly and I feel like it might just be easier to create composable in compose-desktop and then just copy pasta back into my actual app.
    rnett

    rnett

    1 year ago
    That will probably be handled by (and require) incremental compilation for the IR backend, which is still WIP (https://youtrack.jetbrains.com/issue/KT-44317).
    m

    Mark Murphy

    1 year ago
    I would not be surprised if the long-term answer comes in the form of project organization. We may find it best to isolate our composables into a dedicated module (or set of modules) that depend on few other app modules. That has two benefits: 1. It should accelerate build times for that module, by having less code in it and having fewer dependencies that might trigger module-wide rebuilds. 2. Compose and Compose UI are effectively a DSL for UI development. The cost is a lot of top-level namespace pollution, with a zillion very generically-named global functions (e.g.,
    Text()
    ). Personally, I want to keep that away from the bulk of the project. But, as Jim Sproch mentioned in another recent thread here, we only have so much experience with Compose at scale, so there will be a lot of lessons to learn. Also, it will be very interesting if at some point the Compose compiler plugin will work with Kotlin scripting. It might be there already -- I haven't tried it. If that does turn out to (eventually) work, that plus Compose for Desktop really opens up the tooling possibilities. Your "copy pasta" might evolve into a dedicated "micro IDE" focused on rapid development of composables.