Skip to content
This repository was archived by the owner on Feb 5, 2021. It is now read-only.

Conversation

@zach-klippenstein
Copy link
Collaborator

@zach-klippenstein zach-klippenstein commented May 14, 2020

This PR introduces helper functions for showing in-IDE previews of your view factories and ComposeWorkflows. Any nested renderings are automatically stubbed out with placeholders so you can see how your containers will look. This tooling can be used to preview any ViewFactorys, both those implemented with Compose and legacy ones using LayoutRunners or literally anything that implements the ViewFactory interface.

Preview complicated containers

It's especially helpful for previewing how complex containers that show nested renderings will display their children.

image

LayoutRunners and other ViewFactorys

And it works with any ViewFactory, even legacy ones that use LayoutRunner or BuilderBinding!

image

ComposeWorkflow

Also supports ComposeWorkflows.

image

@zach-klippenstein zach-klippenstein force-pushed the zachklipp/compose-tooling branch from 8fa8b75 to a8d2e54 Compare May 14, 2020 23:34
@zach-klippenstein zach-klippenstein force-pushed the zachklipp/compose-tooling branch from a8d2e54 to d3e4f38 Compare May 14, 2020 23:45
@zach-klippenstein zach-klippenstein marked this pull request as ready for review May 14, 2020 23:46
@zach-klippenstein zach-klippenstein requested a review from rjrjr May 14, 2020 23:46
/**
* Returns a [ComposeWorkflow] that renders itself using the given [render] function.
*/
inline fun <PropsT, OutputT : Any> Workflow.Companion.composed(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjrjr This is another friend for Workflow.stateful() and Workflow.stateless().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot that Workflow.stateful even existed, only ever used the other one.

}

@Preview(widthDp = 200, heightDp = 200)
@Composable private fun PreviewStubViewBindingOnWhite() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these magic function names or something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, just the convention. The @Preview annotation is what triggers the IDE preview.

@zach-klippenstein zach-klippenstein merged commit 039f1c8 into master May 15, 2020
@zach-klippenstein zach-klippenstein deleted the zachklipp/compose-tooling branch May 15, 2020 00:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants