Skip to content

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

composeViewFactory

[androidJvm]
Content
@WorkflowUiExperimentalApi()

inline fun <RenderingT : Any> composeViewFactory(noinline content: @Composable()(RenderingT, environment: ViewEnvironment) -> Unit): ViewFactory<RenderingT>
More info

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

Simple usage:

val FooViewFactory = composeViewFactory { 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 ComposeViewFactory.

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