All Projects → AMMA-Family → Keemun

AMMA-Family / Keemun

Licence: MIT License
No description or website provided.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Keemun

Kaskade
[INACTIVE] Simplifying state management
Stars: ✭ 223 (+1615.38%)
Mutual labels:  coroutines, multiplatform, unidirectional-data-flow
Delish
Delish, a Food Recipes App in Jetpack Compose and Hilt based on modern Android tech-stacks and MVI clean architecture.
Stars: ✭ 356 (+2638.46%)
Mutual labels:  coroutines, mvi, mvi-architecture
Unidirectional Architecture On Mobile
Dive into 📱 Unidirectional Architecture!
Stars: ✭ 115 (+784.62%)
Mutual labels:  elm-architecture, android-architecture, unidirectional-data-flow
kmm
Rick & Morty Kotlin Multiplatform Mobile: Ktor, Sqldelight, Koin, Flow, MVI, SwiftUI, Compose
Stars: ✭ 52 (+300%)
Mutual labels:  coroutines, mvi, kotlin-multiplatform
knot
Unidirectional reactive state container for Android & Kotlin
Stars: ✭ 231 (+1676.92%)
Mutual labels:  android-architecture, unidirectional-data-flow, mvi-architecture
Lastik
Kotlin Multiplatform + Jetpack Compose pet project, based on www.last.fm/api (in development)
Stars: ✭ 37 (+184.62%)
Mutual labels:  coroutines, mvi, kotlin-multiplatform
Teapot
Unidirectional Dataflow library for Android inspired by The Elm Architecture
Stars: ✭ 29 (+123.08%)
Mutual labels:  elm-architecture, unidirectional-data-flow
eosreach-android
An EOS wallet developed in Kotlin using the eos-jvm SDK and the model view intent (MVI) design pattern. This wallet serves as a blueprint for how other developers might want to utilise eos-jvm to develop native Android apps that consume the EOS blockchain.
Stars: ✭ 37 (+184.62%)
Mutual labels:  mvi, mvi-architecture
Jetpack-Compose-MVI-Demo
Demo / Sample Android Project created with Jetpack Compose and MVI Architecture Pattern
Stars: ✭ 114 (+776.92%)
Mutual labels:  mvi, mvi-architecture
MVI-Clean-Architecture
MVI + Clean Architecture + Best Practices | Example of Clean Architecture of Android app using MVI design pattern with Jetpack and popular libraries
Stars: ✭ 50 (+284.62%)
Mutual labels:  coroutines, mvi-architecture
android-mvi
Android MVI design pattern in Kotlin
Stars: ✭ 57 (+338.46%)
Mutual labels:  mvi, mvi-architecture
Dads
*BA DUM TSSS*
Stars: ✭ 240 (+1746.15%)
Mutual labels:  unidirectional-data-flow, kotlin-multiplatform
Tracktor-ComposeUI
Track the progress of anything in one place
Stars: ✭ 25 (+92.31%)
Mutual labels:  unidirectional-data-flow, mvi
Elmdroid
Minimalistic Android implementation of The Elm Architecture with android architecture components integration.
Stars: ✭ 25 (+92.31%)
Mutual labels:  elm-architecture, unidirectional-data-flow
webtrekk-android-sdk-v5
Webtrekk Android SDK V5
Stars: ✭ 13 (+0%)
Mutual labels:  coroutines, android-architecture
moko-errors
Automated exceptions handler for mobile (android & ios) Kotlin Multiplatform development.
Stars: ✭ 45 (+246.15%)
Mutual labels:  coroutines, kotlin-multiplatform
weather-app-2020-android
Android Weather App 2020
Stars: ✭ 15 (+15.38%)
Mutual labels:  mvi, mvi-architecture
PopKorn
DI can be simple. Forget about modules and components. Just use it!
Stars: ✭ 139 (+969.23%)
Mutual labels:  multiplatform, kotlin-multiplatform
ToDometer Multiplatform
WIP Kotlin Multiplatform project: A meter to-do list built with Android Jetpack, Compose UI Multiplatform, Wear Compose, SQLDelight, Koin Multiplatform, SwiftUI, Ktor Server / Client, Exposed...
Stars: ✭ 145 (+1015.38%)
Mutual labels:  multiplatform, kotlin-multiplatform
kotlin-multiplatform-example
A barebones Kotlin multiplatform project with JVM and JS targets
Stars: ✭ 15 (+15.38%)
Mutual labels:  multiplatform, kotlin-multiplatform

Maven Central

Keemun

Add the library to your build.gradle.kts file.

implementation("family.amma:keemun:1.2.3")

Multiplatform part

Entities

@Parcelize
data class State(
    val user: User?
) : Parcelable

data class ViewState(
    // Example
    // English - "Age: 30"
    // Russian - "Возраст: 30"
    // etc
    val localizedAge: String?
)

sealed class Msg {
    data class UserWasLoaded(val user: User) : Msg()
}

sealed class Effect {
    object LoadUser : Effect()
}

An example of creating FeatureParams:

typealias SomeFeatureParams = FeatureParams<State, Msg, Effect>
typealias SomeFeatureEffectHandler = EffectHandler<Effect, Msg>

internal fun someFeatureParams(effectHandler: SomeFeatureEffectHandler): SomeFeatureParams =
    FeatureParams(
        init = init,
        update = updater,
        effectHandler = effectHandler
    )

val init = InitFeature<State, Effect> { previous ->
    val state = previous ?: State(user = null)
    state to setOf(Effect.LoadUser)
}

val updater = Update<State, Msg> { msg, state ->
    when (msg) {
        is Msg.UserWasLoaded -> state.copy(user = msg.user) to emptySet()
    }  
}

fun effectHandler(repo: UserRepository) = SomeFeatureEffectHandler { effect, dispatch ->
    when (effect) {
        Effect.LoadUser -> {
            val user = repo.loadUser()
            dispatch(Msg.UserWasLoaded(user))
        }
    }
}

Platform part (Android)

// StateTransform<State, ViewState> = suspend (State) -> ViewState 
private fun stateTransform(getContext: () -> Context) = StateTransform<State, ViewState> { state ->
    ViewState(
        localizedAge = state.user?.age?.let { getContext().getString(R.string.age, it) }
    )
}

Add to your Fragment/Activity

class SomeFragment(featureParams: () -> SomeFeatureParams) : Fragment(R.layout.fragment_some) {
    private val feature by androidConnectors(featureParams, getStateTransform = { stateTransform(::requireContext) })

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        feature.render(this) { viewState ->
            ageTextView.text = viewState.localizedAge
        }
        // OR 
        // feature.collectWithLifecycle(viewLifecycleOwner, Lifecycle.State.STARTED) { viewState -> }
    }
}

Send messages to change state

feature dispatch Msg.Foo
feature syncDispatch Msg.Bar
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].