Good morning! Does anyone knows if there is a way to create Composable elements at runtime? I am working on a sort of playground but I am struggling with creating the preview components.
Zach Klippenstein (he/him) [MOD]
1 year ago
Technically all compose elements are created at runtime, but it sounds like what you’re trying to do is actually compile and execute Kotlin code with the compose compiler plugin at runtime? I’m sure there’s a way to do that with the kotlin compiler, but i’m not sure how. Might want to take a look at the (relatively new) kotlin shell, ki, for a starting place: https://blog.jetbrains.com/kotlin/2021/04/ki-the-next-interactive-shell-for-kotlin/