I do have another question regarding compose-multi...
# compose
j
I do have another question regarding compose-multiplatform and previews. Right now I am using this template https://github.com/JetBrains/compose-multiplatform-template. The only way I found to display previews of composables is by using this plugin for desktop https://plugins.jetbrains.com/plugin/16541-compose-multiplatform-ide-support. Is it possible to have also previews for android?
k
IIRC, android previews work fine in an android source set
j
ah, yes. You are right. I could make it work. Eg: I have created a composable in shared/commonMain
Copy code
@Composable
fun CommonMainView(){
    Text(text = "Hello CommonMainView")
}
and in my androidApp I was able to display a preview with
Copy code
@Preview
@Composable
fun CommonMainViewPreview(){
    CommonMainView()
}
@Konstantin Tskhovrebov is the @Preview annotation in commonMain available?
E.g. I have a composable defined in commonMain and I would like to have the Preview-Composable also defined in commonMain. I only could build previews by using desktop and/or android src-set.
j
ok, thank you. Would be nice, because now you have to rebuild each time you make changes
k
just use preview functions on Android or Desktop side
j
the downside of this approach is that as mentioned before I have to rebuild & refresh to see changes in my previews. If I have my composable and preview in the same file changes are instantly visible