Skip to content

//workflow/com.squareup.workflow1.ui.compose/composeScreenViewFactory

composeScreenViewFactory

[androidJvm]
Content
@WorkflowUiExperimentalApi()

inline fun <RenderingT : Screen> composeScreenViewFactory(noinline content: @Composable()(RenderingT, environment: ViewEnvironment) -> Unit): ScreenViewFactory<RenderingT>
More info

Creates a ScreenViewFactory that uses a Composable function to display the rendering.

Simple usage:

val FooViewFactory = composeScreenViewFactory { rendering, _ ->
Text(rendering.message)
}

…

val viewRegistry = ViewRegistry(FooViewFactory, …)

If you need to write a class instead of a function, for example to support dependency injection, see ComposeScreenViewFactory.

For more details about how to write composable view factories, see ComposeScreenViewFactory.