Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek-12 authored Oct 4, 2022
1 parent 1a2dc9f commit 7b955d9
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ Choose your dependency:
[![](https://jitpack.io/v/Nek-12/FlowMVI.svg)](https://jitpack.io/#Nek-12/FlowMVI)

```kotlin
val flowVersion = /* look at the widget */
implementation("com.github.Nek-12.FlowMVI:core:${flowVersion}") //does not depend on any particular platform
val flowVersion = /* look at the widget */
implementation("com.github.Nek-12.FlowMVI:core:${flowVersion}") //does not depend on any particular platform
implementation("com.github.Nek-12.FlowMVI:android-compose:${flowVersion}") //For Jetpack Compose Android projects
implementation("com.github.Nek-12.FlowMVI:android-view:${flowVersion}") //For View-based Android projects
```

## Core:

```kotlin
sealed class ScreenState: MVIState {
object Loading: ScreenState()
data class Error(e: Exception): ScreenState()
sealed interface ScreenState: MVIState { // using interfaces is more performant and adheres to MVI principles
object Loading: ScreenState
data class Error(e: Exception): ScreenState
data class DisplayingCounter(
val counter: Int,
): ScreenState()
): ScreenState
}

sealed class ScreenIntent: MVIIntent {
object ClickedCounter: ScreenIntent()
sealed interface ScreenIntent: MVIIntent {
object ClickedCounter: ScreenIntent
}

sealed class ScreenAction: MVIAction {
data class ShowMessage(val message: String): ScreenAction()
sealed interface ScreenAction: MVIAction {
data class ShowMessage(val message: String): ScreenAction
}


Expand Down Expand Up @@ -83,8 +83,7 @@ fun ComposeScreen() = MVIComposable(

consume { action ->
when (action) {
is ShowMessage -> { /* ... */
}
is ShowMessage -> { /* ... * }
}
}
Expand Down

0 comments on commit 7b955d9

Please sign in to comment.