Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding simple examples to README.md #268

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Laimiux
Copy link
Collaborator

@Laimiux Laimiux commented Mar 24, 2022

What

I'm adding simple, but full examples to README.md. The goal is to show how Formula looks without getting too deep into details and best practices.

@carrotkite
Copy link

JaCoCo Code Coverage 80.64% ✅

Class Covered Meta Status

Generated by 🚫 Danger

val decrementButton: Button = ...

// We convert Formula instance to RxJava observable.
val counterOutput: Observable<CounterFormula.Output> = CounterFormula().toObservable()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can show the example without using RxJava. Possible? Or maybe this should switch to Flow, might be more familiar to Android devs now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Flow example as well

RxAction.fromObservable { repository.getCounterState() }.onEvent { currentCount ->
val newState = state.copy(currentCount = currentCount)
transition(newState)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to use Flow here as well yet? I don't think we support it yet, but if we do, maybe we could add that example too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, though I'm not yet sure how to best incorporate in in examples as there is RxJava as well. I will think about it more

Copy link

@jasonostrander jasonostrander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants