Skip to content
This repository was archived by the owner on Feb 5, 2021. It is now read-only.

Update README with dependency instructions for v0.29.0. #31

Merged
merged 1 commit into from
May 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# workflow-kotlin-compose

[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![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)

This module provides experimental support for [Jetpack Compose UI][1] with workflows.

The only integration that is currently supported is the ability to define [ViewFactories][2] that
Expand All @@ -20,8 +23,24 @@ and to experiment with various ways to integrate Compose with Workflow.

## Usage

To get started, you must be using the latest Android Gradle Plugin 4.x version. Then, you need to
enable Compose support in your `build.gradle`:
### Add the dependency

Add the dependencies from this project (they're on Maven Central):

```groovy
dependencies {
// Main dependency
implementation "com.squareup.workflow:workflow-ui-core-compose:${versions.workflow_compose}"

// For the preview helpers
implementation "com.squareup.workflow:workflow-ui-compose-tooling:${versions.workflow_compose}"
}
```

### Enable Compose

You must be using the latest Android Gradle Plugin 4.x version, and enable Compose support
in your `build.gradle`:

```groovy
android {
Expand All @@ -47,7 +66,7 @@ To create a `ViewFactory`, call `bindCompose`. The lambda passed to `bindCompose
function.

```kotlin
val HelloBinding = bindCompose<MyRendering> { rendering ->
val HelloBinding = bindCompose<MyRendering> { rendering, _ ->
MaterialTheme {
Clickable(onClick = { rendering.onClick() }) {
Text(rendering.message)
Expand Down