Hi all, it's my first post here :wave: I've recent...
# compose-ios
b
Hi all, it's my first post here đź‘‹ I've recently started developing an app with Compose Multiplatform and noticed that `@Preview @Composable`s defined in the
commonMain
source set don't work. Is this expected, and if not, do you plan to address it somehow?
a
@Preview
only works for JVM targets, so it should work Android/Desktop
b
Yeah, but then I have to define my composables in
shared/commonMain
, but write previews in
androidApp/main
, right? I think it's an okay-ish workaround but not perfect.
a
That's correct
a
That's what I do, more specifically I define previews only for Android debug source set. The desktop previews are extremely limited, I would avoid them personally unless desktop is a target you actually care about.
Android previews are much more flexible and support things like preview parameters.
also don’t forget to add this to your
android
block:
Copy code
buildFeatures { compose = true }
composeOptions {
    kotlinCompilerExtensionVersion = composeCompilerVersion
}
where
composeCompilerVersion
should be in sync with the Kotlin version https://developer.android.com/jetpack/androidx/releases/compose-kotlin#pre-release_kotlin_compatibility