79427050

Date: 2025-02-10 12:28:40
Score: 1
Natty:
Report link

This happened while I was working with Kotlin Multiplatform and thanks to @aga for the answer, the implementation is a quite different but concept remains the same

In you build.gradle.kts go to the bottom end of the file and define the dependencies and add this debugImplementation "androidx.compose.ui:ui-tooling"

dependencies {
    debugImplementation("androidx.compose.ui:ui-tooling")
}

How to use it

sync the project and Now go to android[main] and create a Kotlin file and annotate with @androidx.compose.ui.tooling.preview.Preview and @composable

Example

@androidx.compose.ui.tooling.preview.Preview
@Composable
fun preview() {
    Yourcomposable()
}

That's all, Happy coding

Reasons:
  • Blacklisted phrase (0.5): thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @aga
  • Low reputation (0.5):
Posted by: Jadu