Are preview functions also compiled in with the co...
# compose
z
Are preview functions also compiled in with the code? If not couldn't the compose compiler plugin just delete functions annotated with Preview? I cant think of any reason why they would need to be in the resulting build
r
@Preview is not a concept known by the compiler plugin. In fact none of the "Compose UI" layers are known by the compiler, it's just a usage of Compose the runtime.
Also previews need to be compiled to be executed and rendered, and a preview could very well be used by the app at runtime (there's nothing special about a preview composable).
R8 will however get rid of previews not invoked by the app
☝️ 3
☝🏻 1
(and it's highly recommended you use R8 if you are targeting Android)