Skip to content

Commit

Permalink
Punched up kdoc for ComposeScreen, ScreenComposableFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrjr committed Jan 26, 2024
1 parent 7d6e47b commit 0f2fac6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.squareup.workflow1.ui.compose

import androidx.compose.runtime.Composable
import com.squareup.workflow1.ui.AndroidScreen
import com.squareup.workflow1.ui.Screen
import com.squareup.workflow1.ui.ViewEnvironment
import com.squareup.workflow1.ui.ViewRegistry
Expand All @@ -10,7 +9,16 @@ import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
/**
* Interface implemented by a rendering class to allow it to drive a composable UI via an
* appropriate [ScreenComposableFactory] implementation, by simply overriding the [Content] method.
* This is the compose analog to [AndroidScreen].
*
* Note that it is generally an error for a [Workflow][com.squareup.workflow1.Workflow]
* to declare [ComposeScreen] as its `RenderingT` type -- prefer [Screen] for that.
* [ComposeScreen], like [AndroidScreen][com.squareup.workflow1.ui.AndroidScreen],
* is strictly a possible implementation detail of [Screen]. It is a convenience to
* minimize the boilerplate required to set up a [ScreenComposableFactory].
* That interface is the fundamental unit of Compose tooling for Workflow UI.
* But in day to day use, most developer will work with [ComposeScreen] and be only
* vaguely aware of the existence of [ScreenComposableFactory],
* so the bulk of our description of working with Compose is here.
*
* **NB**: A Workflow app that relies on Compose must call [withComposeInteropSupport]
* on its top-level [ViewEnvironment]. See that function for details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ internal fun <ScreenT : Screen> ScreenComposableFactory(

/**
* A [ViewRegistry.Entry] that uses a [Composable] function to display [ScreenT].
* This is the Compose-based analogue of
* [ScreenViewFactory][com.squareup.workflow1.ui.ScreenViewFactory]. But unlike
* [ScreenViewFactory], it is unusual for app developers to interact with this
* class directly. Most of the time you can subclass [ComposeScreen] and rely on
* the standard hidden [ScreenComposableFactory] that backs it.
* This is the fundamental unit of Compose tooling in Workflow UI, the Compose analogue of
* [ScreenViewFactory][com.squareup.workflow1.ui.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.
*
* - See [ComposeScreen] for a more complete description of using Compose to
* build a Workflow-based UI.
Expand All @@ -78,7 +80,6 @@ internal fun <ScreenT : Screen> ScreenComposableFactory(
* renderWorkflowIn(
* workflow = MyWorkflow.mapRendering { it.withEnvironment(viewEnvironment) }
* )
*
*/
@WorkflowUiExperimentalApi
public interface ScreenComposableFactory<in ScreenT : Screen> : ViewRegistry.Entry<ScreenT> {
Expand Down

0 comments on commit 0f2fac6

Please sign in to comment.