Skip to content

Preview annotation in commonMain sourceSet #2045

Closed
@IlyaGulya

Description

@IlyaGulya

It is good to have multiplatform Preview annotation for all target platforms in commonMain sourceSet.


Hello!
Currently desktop preview rendering is possible only in desktop sourceSet because ui-tooling-preview publishes androidx.compose.desktop.ui.tooling.preview.Preview annotation only for desktop sourceSet.

However, I've been able to successfully use current Compose Multiplatform IDE Support plugin to render preview defined in common sourceSet.

You can check the example here:https://github.com/IlyaGulya/compose-jb/tree/example/common-desktop-preview/experimental/examples/falling-balls-mpp
I've moved GamePreview to common sourceSet and added stub androidx.compose.desktop.ui.tooling.preview.Preview annotation to trigger Compose Multiplatform IDE Support plugin to add gutter icon on GamePreview function.

I think Compose MPP team should consider publishing androidx.compose.desktop.ui.tooling.preview.Preview annotation for common sourceSet instead of desktop.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions