Hey folks! Is there any particular reason why `@Pr...
# compose
a
Hey folks! Is there any particular reason why
@Preview
annotation has
@Retention(AnnotationRetention.SOURCE)
but not
RUNTIME
? I'm trying to build a component gallery app, and would like to find all the Preview composables using reflection. Unfortunately I cannot do it right now without using codegen. Would it make sense for me to send a PR changing retention from
SOURCE
to
RUNTIME
?
e
v
Have you tried using this - https://github.com/airbnb/Showkase Might be exactly what you are trying to build
☝️ 2
e
yep, and Showkase works via annotation processing, not reflection, which avoids both the problem of the annotation not being seen at runtime, and also avoids the problem of
@Composable
not being reflectively invokable
a
Thanks for your answers. I've seen Showkase, and it solves very similar problem I'm trying to solve. But I'm experimenting with Jetbrains Compose so can't use it for now 😞 Regarding the reflective invocations. It is not impossible, and actually `PreviewActivity`(used to run previews on device) already uses it. So reusing the code from it should do the trick for Preview cases, but the problem is that I cannot find Preview annotated composables in runtime. I'm trying to avoid using codegen for now, but maybe it is the right way to do it😅
a
@nosuid
v
When you say Jetbrains Compose do you mean Compose for Desktop? I’m definitely interested in adding support for that in Showkase. Might give it a shot at some point!
a
Yeah, I meant Compose for Desktop & KMM. The main issue is that Jetpack & Jetbrains have diffenet artifacts, but it will be addressed eventually. And then it would be pretty easy to adopt it in Showkase
👍🏼 1
n
Sorry for the late response. We did not have a use case to make it runtime but we can consider that in a future release.