This repository was archived by the owner on Feb 5, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change 11# workflow-kotlin-compose
22
3+ [ ![ GitHub license] ( https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat )] ( https://www.apache.org/licenses/LICENSE-2.0 )
4+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/com.squareup.workflow/workflow-ui-core-compose.svg?label=Maven%20Central )] ( https://search.maven.org/search?q=g:com.squareup.workflow%20AND%20a:workflow-ui-core-compose )
5+
36This module provides experimental support for [ Jetpack Compose UI] [ 1 ] with workflows.
47
58The only integration that is currently supported is the ability to define [ ViewFactories] [ 2 ] that
@@ -20,8 +23,24 @@ and to experiment with various ways to integrate Compose with Workflow.
2023
2124## Usage
2225
23- To get started, you must be using the latest Android Gradle Plugin 4.x version. Then, you need to
24- enable Compose support in your ` build.gradle ` :
26+ ### Add the dependency
27+
28+ Add the dependencies from this project (they're on Maven Central):
29+
30+ ``` groovy
31+ dependencies {
32+ // Main dependency
33+ implementation "com.squareup.workflow:workflow-ui-core-compose:${versions.workflow_compose}"
34+
35+ // For the preview helpers
36+ implementation "com.squareup.workflow:workflow-ui-compose-tooling:${versions.workflow_compose}"
37+ }
38+ ```
39+
40+ ### Enable Compose
41+
42+ You must be using the latest Android Gradle Plugin 4.x version, and enable Compose support
43+ in your ` build.gradle ` :
2544
2645``` groovy
2746android {
@@ -47,7 +66,7 @@ To create a `ViewFactory`, call `bindCompose`. The lambda passed to `bindCompose
4766function.
4867
4968``` kotlin
50- val HelloBinding = bindCompose<MyRendering > { rendering ->
69+ val HelloBinding = bindCompose<MyRendering > { rendering, _ ->
5170 MaterialTheme {
5271 Clickable (onClick = { rendering.onClick() }) {
5372 Text (rendering.message)
You can’t perform that action at this time.
0 commit comments