# compose

Grigorii Yurkov

10/25/2020, 7:35 PM
Why not make
workable with Composable functions with arguments? As I understand almost all arguments are data classes. Compiler can instantiate them using primary constructor. For example:
Copy code
data class Post(
    val title: String,
    val description: String
Default instance for this class can be
Post("Title", "Description")
. Same with Lists of data classes, but compiler can add index for each instance
Post("Title №0", "Description №0")
Post("Title №1", "Description №1")
, etc. So in most cases you don't need to create special preview composable functions or mess around with
. What do you think?
👎 4
👍 3


10/25/2020, 10:16 PM
I think it's a cool idea to make things quicker to prototype, but at the same time I think it's always useful to be using "real-ish" data for composables right from the start or else some faulty assumptions are bound to bite you later on. Perhaps the reason it seems hard to write the default values in the preview composable function or data class is because you need to think about what might actually go there?
I haven't tried it but if you're really lazy to think of real-ish data something like could be fun 😄
👍 1

Grigorii Yurkov

10/25/2020, 10:41 PM
@caelum19 I noticed that I fill my data classes with absolutely random values, because I don't care what values I want to see on screen. But know I am realising that subconsciously I fill "description" field with larger string, because it's description, it should be large, and I want to test ui with large description. By the way, thank you for the library. I didn't even know it exists. I'm going to try it.


10/26/2020, 11:13 AM
You got a good point 👌