All Projects → etiennelenhart → Eiffel

etiennelenhart / Eiffel

Licence: mit
Redux-inspired Android architecture library leveraging Architecture Components and Kotlin Coroutines

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Eiffel

Androidroom
Android example to show how to use Room to access SQLite database on device for reading and writing data. This example also shows how to use LiveData and ViewModel with Room to build reactive, well performing and easy to maintain applications.
Stars: ✭ 36 (-82.27%)
Mutual labels:  android-architecture, viewmodel
Cameraxdemo
A sample camera app with CameraX API from Android Jetpack
Stars: ✭ 112 (-44.83%)
Mutual labels:  kotlin-coroutines, android-architecture
Permissionsflow
A simple library to make it easy requesting permissions in Android using Kotlin Coroutines.
Stars: ✭ 49 (-75.86%)
Mutual labels:  kotlin-coroutines, android-architecture
News
A sample News 🗞 app built using Modern Android Development [Architecture Components, Coroutines, Retrofit, Room, Kotlin, Dagger]
Stars: ✭ 774 (+281.28%)
Mutual labels:  android-architecture, viewmodel
Coolweather
Weather App that uses Android best practices. Android Jetpack, clean architecture. Written in Kotlin
Stars: ✭ 154 (-24.14%)
Mutual labels:  android-architecture, viewmodel
Peopleinspace
Minimal Kotlin Multiplatform project using Jetpack Compose and SwiftUI
Stars: ✭ 887 (+336.95%)
Mutual labels:  kotlin-coroutines, viewmodel
Android Mvvm Coroutine
Kotlin android application example with MVVM pattern, android architecture, kotlin coroutine, unit test, and UI test
Stars: ✭ 111 (-45.32%)
Mutual labels:  android-architecture, viewmodel
Mvvmarms
Android MVVM Architecture Components based on MVPArms and Android Architecture Components.
Stars: ✭ 425 (+109.36%)
Mutual labels:  android-architecture, viewmodel
Mvp Architecture Components
This is a sample project, showing the connection between Android Architecture Components and MVP pattern.
Stars: ✭ 143 (-29.56%)
Mutual labels:  android-architecture, viewmodel
Android Mvvm Architecture
A basic sample android application to understand MVVM in a very simple way.
Stars: ✭ 129 (-36.45%)
Mutual labels:  android-architecture, viewmodel
Reactive Mvvm Android
My way to MVVM using KotlinX Coroutines and Android data-binding
Stars: ✭ 626 (+208.37%)
Mutual labels:  kotlin-coroutines, viewmodel
Androidbaseframemvvm
Android 组件化 MVVM 框架 基于 Jetpack + Kotlin
Stars: ✭ 169 (-16.75%)
Mutual labels:  kotlin-coroutines, viewmodel
Kotlin Coroutines Android Examples
Learn Kotlin Coroutines for Android by Examples. Learn how to use Kotlin Coroutines for Android App Development.
Stars: ✭ 572 (+181.77%)
Mutual labels:  kotlin-coroutines, viewmodel
Mvvm Redux
MVVM Redux is a lightweight lib to help you apply the redux concepts in your project based in MVVM.
Stars: ✭ 30 (-85.22%)
Mutual labels:  android-architecture, state-management
Roxie
Lightweight Android library for building reactive apps.
Stars: ✭ 441 (+117.24%)
Mutual labels:  android-architecture, state-management
Easychatandroidclient
EasyChat是一个开源的社交类的App。主要包含消息、好友、群组等相关的IM核心功能。部分界面参照了QQ、微信等相关社交APP。EasyChat APP整体采用MVVM模式,基于JetPack(Lifecycle,LiveData,ViewModel,Room)构建
Stars: ✭ 64 (-68.47%)
Mutual labels:  kotlin-coroutines, viewmodel
Expenso
📊 A Minimal Expense Tracker App built to demonstrate the use of modern android architecture component with MVVM Architecture
Stars: ✭ 325 (+60.1%)
Mutual labels:  kotlin-coroutines, android-architecture
Uniflow Kt
Uniflow 🦄 - Simple Unidirectional Data Flow for Android & Kotlin, using Kotlin coroutines and open to functional programming
Stars: ✭ 414 (+103.94%)
Mutual labels:  kotlin-coroutines, viewmodel
Teammate Android
A Team Management app for creating tournaments and games for various sports
Stars: ✭ 116 (-42.86%)
Mutual labels:  android-architecture, viewmodel
Notzz App
📝 A Simple Note-Taking App built to demonstrate the use of Modern Android development tools - (Kotlin, Coroutines, State Flow, Hilt-Dependency Injection, Jetpack DataStore, Architecture Components, MVVM, Room, Material Design Components).
Stars: ✭ 158 (-22.17%)
Mutual labels:  kotlin-coroutines, android-architecture

Eiffel

Build Status JitPack Tweet

Logo

A Redux-inspired Android architecture library leveraging Architecture Components and Kotlin Coroutines.

Any questions or feedback? Feel free to contact me on Twitter @etiennelenhart.

Quick example

data class HelloEiffelState(val greeting: String = "Hello Eiffel") : State

sealed class HelloEiffelAction : Action {
    object NowInFrench : HelloEiffelAction()
    data class Greet(val name: String) : HelloEiffelAction()
}

val helloEiffelUpdate = update<HelloEiffelState, HelloEiffelAction> { action ->
    when (action) {
        is HelloEiffelAction.NowInFrench -> copy(greeting = greeting.replace("Hello", "Salut"))
        is HelloEiffelAction.Greet -> copy(greeting = "Salut ${action.name}")
    }
}

class HelloEiffelViewModel(initialState: HelloEiffelState) :
    EiffelViewModel<HelloEiffelState, HelloEiffelAction>(initialState) {
    override val update = helloEiffelUpdate
}

class HelloEiffelFragment : Fragment() {
    private val viewModel: HelloEiffelViewModel by eiffelViewModel()
    ...
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        // example with View Bindings
        binding = FragmentHelloEiffelBinding.inflate(inflater, container, false)

        viewModel.state.observe(viewLifecycleOwner) { state ->
            binding.greetingText.text = state.greeting
        }
        binding.frenchButton.setOnClickListener { viewModel.dispatch(HelloEiffelAction.NowInFrench) }

        return binding.root
    }
    ...
}

Installation

build.gradle (project)

repositories {
    maven { url 'https://jitpack.io' }
}

build.gradle (module)

dependencies {
    implementation 'com.github.etiennelenhart.eiffel:eiffel:5.0.0'
    implementation 'com.github.etiennelenhart.eiffel:eiffel-test:5.0.0'
}

Features

Apart from providing Redux-like reactive ViewModels, Eiffel includes the following features to simplify common Android-related tasks and architecture plumbing:

  • First class support for Kotlin Coroutines and Flow
  • Powerful middleware functionality in the form of Interceptions with an easy-to-use DSL
  • Extended state observing for subscribing to specific state properties only
  • Convenient way to restore part or all of a state after process death
  • BindableState class to adapt one or more states for use with Data Binding
  • Simple option to pass Intent extras and Fragment arguments to a ViewModel's initial state
  • Implementation of a ViewEvent for one-off events inside of states
  • Resource wrapper to associate a status to LiveData
  • Delegated properties to lazily access a ViewModel indside an Activity or Fragment
  • A dedicated debug mode to trace all dispatched actions, interception calls and state updates
  • Separate testing module with JUnit rules to test async behavior and helpers to test a chain of Interceptions in isolation

Info on all of these and more can be found in the Wiki.

Interceptions DSL

Eiffel includes an easy-to-use Domain-specific language for creating a chain of Interceptions. This allows you to define the logic of your ViewModel domain in a simple and declarative way. Iterating on the quick example above, this is how you can define a set of interceptions in a few lines of code:

val helloEiffelInterceptions = interceptions<HelloEiffelState, HelloEiffelAction> {
    add(CustomInterception()) // your custom interception
    pipe { _, action -> Analytics.log("HelloEiffel", action) } // log something to analytics
    on<HelloEiffelAction.Greet> { // following will only react to 'Greet' action
        adapter("Upper case name") { _, action ->
            HelloEiffelAction.Greet(action.name.toUpperCase())
        }
        filter { state, action -> // ignore duplicate button presses and empty names
            !state.greeting.contains(action.name) || action.name.isNotBlank()
        }
    }
}

class HelloEiffelViewModel(initialState: HelloEiffelState) :
    EiffelViewModel<HelloEiffelState, HelloEiffelAction>(initialState) {
    override val update = helloEiffelUpdate
    override val interceptions = helloEiffelInterceptions
}

Migration

Migration guides for breaking changes:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].