Transpile Compose `@Preview`s from SwiftUI `#Preview`
Open
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 3.2k
- Forks
- 106
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
It's convenient to see @Previews in Android Studio. As it stands, I have to write a lot of complicated boilerplate for this:
#if SKIP
@Preview(showBackground = true)
@Composable
fun WelcomeViewPreview() {
ProcessInfo.launch(LocalContext.current)
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
WelcomeView(welcomeName = Binding.constant("Skipper"))
.Compose(context = ComposeContext())
}
}
#else
#Preview {
WelcomeView(welcomeName: Binding.constant("Skipper"))
}
#endif
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how SwiftUI #Preview declarations are currently transpiled and how existing SKIP preview handling maps to Android Compose. The work is done when the concise #Preview example produces the equivalent Compose @Preview behavior without the conditional boilerplate shown in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, swift
- Domain
- compilers, mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100