ScreenComposableFactory

A ViewRegistry.Entry that uses a Composable function to display ScreenT. This is the fundamental unit of Compose tooling in Workflow UI, the Compose analogue of ScreenViewFactory.

ScreenComposableFactory is also a bit cumbersome to use directly, so ComposeScreen is provided as a convenience. Most developers will have no reason to work with ScreenComposableFactory directly, or even be aware of it.

Use ScreenComposableFactory directly if you need to prevent your Screen rendering classes from depending on Compose at compile time.

Example:

val fooComposableFactory = ScreenComposableFactory { screen, _ ->
  Text(screen.message)
}

val viewRegistry = ViewRegistry(fooComposableFactory, …)
val viewEnvironment = ViewEnvironment.EMPTY + viewRegistry

renderWorkflowIn(
  workflow = MyWorkflow.mapRendering { it.withEnvironment(viewEnvironment) }
)

Properties

Link copied to clipboard
Link copied to clipboard
abstract val type: KClass<in ScreenT>

Functions

Link copied to clipboard
abstract fun Content(rendering: ScreenT)

The composable content of this ScreenComposableFactory. This method will be called any time rendering changes. It is the Compose-based analogue of ScreenViewRunner.showRendering.