GithubHelp home page GithubHelp logo

canh912009 / mvi-coroutines-flow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kotlin-android-open-source/mvi-coroutines-flow

0.0 0.0 0.0 25 MB

Play MVI with Kotlin Coroutines Flow | MVI pattern on Android using Kotlin Coroutines Flow | Dagger Hilt DI | Koin DI | SharedFlow | StateFlow | Arrow.kt Android Sample

Home Page: https://github.com/hoc081098

License: MIT License

Kotlin 100.00%

mvi-coroutines-flow's Introduction

MVI-Coroutines-Flow

MVI-Coroutines-Flow-Clean-Architecture

MVI-Coroutines-Flow-Clean-Architecture-ArrowKt

MVI-Coroutines-Flow-Clean-Architecture-ArrowKt-KoinDI

All Contributors

Build CI Unit Tests CI codecov Qodana Validate Gradle Wrapper API Kotlin Hits License: MIT Gitter


Liked some of my work? Buy me a coffee (or more likely a beer)

Buy Me A Coffee

Coroutine + Flow = MVI ❤️

  • Play MVI with Kotlin Coroutines Flow.
  • Multiple modules, Clean Architecture, Functional programming with ΛRROW.kt.
  • Unit tests for MVI ViewModel, domain and data layer.
  • Master branch using Koin for DI.
  • Checkout dagger_hilt branch, using Dagger Hilt for DI (obsolete, will update as soon as possible).
  • Download latest debug APK here.

More

1. Jetpack Compose Version

👉 https://github.com/Kotlin-Android-Open-Source/Jetpack-Compose-MVI-Coroutines-Flow

2. Pagination Horizontal List in Vertical List

👉 https://github.com/Kotlin-Android-Open-Source/Pagination-MVI-Flow

Light theme

List view state Error view state
Add new user Search user

Dark theme

List view state Error view state
Add new user Search user

MVI pattern

This pattern was specified by André Medeiros (Staltz) for a JavaScript framework he has written called cycle.js. From a theoretical (and mathematical) point of view we could describe Model-View-Intent as follows 1

  • intent(): This function takes the input from the user (i.e. UI events, like click events) and translate it to “something” that will be passed as parameter to model() function. This could be a simple string to set a value of the model to or more complex data structure like an Object. We could say we have the intention to change the model with an intent.
  • model(): The model() function takes the output from intent() as input to manipulate the Model. The output of this function is a new Model (state changed). So it should not update an already existing Model. We want immutability! We don’t change an already existing Model object instance. We create a new Model according to the changes described by the intent. Please note, that the model() function is the only piece of your code that is allowed to create a new Model object. Then this new immutable Model is the output of this function. Basically, the model() function calls our apps business logic (could be an Interactor, Usecase, Repository … whatever pattern / terminology you use in your app) and delivers a new Model object as result.
  • view(): This method takes the model returned from model() function and gives it as input to the view() function. Then the View simply displays this Model somehow. view() is basically the same as view.render(model).

Reference

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Petrus Nguyễn Thái Học

💻 🚧 🤔 🎨 🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

Footnotes

  1. https://hannesdorfmann.com/android/mosby3-mvi-2/

mvi-coroutines-flow's People

Contributors

hoc081098 avatar renovate[bot] avatar renovate-bot avatar dependabot[bot] avatar alphaandomage avatar allcontributors[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.