https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
mvikotlin
  • l

    lehakorshun

    05/27/2020, 2:12 PM
    @Arkadii Ivanov добрый день, пока нас двое в канале, спрошу по русски, прочел вашу статью и статью по MVICore, но так и не понял, что такое Effect, посмотрел сэмпл в mvikotlin, так же не нашел пока что это, можете как то пояснить что это такое?
    a
    • 2
    • 7
  • s

    Skeptick

    06/29/2020, 5:58 AM
    Hello! Samples for iOS use SwiftUI, but it’s only for iOS 13+ and in most cases is not suitable for production. I would like to see the most primitive example of use with ordinary
    UIViewController
    . More specifically, working with Lifecycle, subscription for state changes and sending events. If I just copy
    LifecycleRegistryExt
    and
    LifecycleWrapper
    and do:
    override func viewDidLoad() {
    self.viewLifecycle = LifecycleRegistry()
    self.controller?.controller.onViewCreated(...)
    self.controller?.lifecycle.start()
    }
    override func viewDidAppear(_ animated: Bool) {
    self.viewLifecycle?.resume()
    }
    override func viewDidDisappear(_ animated: Bool) {
    self.viewLifecycle?.destroy()
    }
    deinit {
    self.controller?.lifecycle.stop()
    }
    Would this be the right approach?
    a
    a
    • 3
    • 16
  • s

    Skeptick

    06/29/2020, 6:35 AM
    Another issue that concerns me is getting State. I used the same approach with Proxy as in the example. But
    @Published
    replaced with
    PublishSubject
    from RxSwift. I don’t like the need to use an additional library for such a simple task. In addition, in mpp-library I use coroutines. Perhaps there is an easier way to signal the
    UIViewController
    of a state change?
    a
    • 2
    • 2
  • a

    aiidziis

    06/30/2020, 12:45 PM
    Hey! Are there plans adding more flexible logging strategy for
    mvikotlin-logging
    , for now everything gets logged,
    storeName
    ,
    eventType
    and
    value
    , but
    value
    sometimes gets huge (mainly because of
    Model
    and
    State
    data classes) and pollutes the logcat. I saw that now we can specify
    maxLenght
    for log message, but that is more like guessing game.
    a
    • 2
    • 10
  • s

    Skeptick

    07/16/2020, 3:39 PM
    Hello! In android I am using
    StateKeeperProvider
    to keep
    Store
    during configuration change. I do it as in the example:
    stateKeeperProvider.retainStore (lifecycle) {...
    But when I close the fragment and reopen it, I get the error “_The supplier is already register with this key: class com.example.MyStore_”. Shouldn’t the supplier unregister in such cases? And what should I do to avoid getting this error?
    a
    • 2
    • 29
  • l

    lehakorshun

    08/27/2020, 2:29 PM
    Hi, I want to clarify, does StateKeeper work when process was killed by system?
    a
    • 2
    • 1
  • j

    JimK

    09/03/2020, 2:59 PM
    Hey, working with the TimeTravel feature it appears that if you use a Store with a Unit Action (to kickstart database load) that it is unable to be serialized when exporting. Is there a workaround for such cases?
    a
    • 2
    • 5
  • l

    lehakorshun

    09/03/2020, 4:09 PM
    Hey, I try to understand, I use
    instanceKeeper
    for reusing Store and in init I add
    lifecycle.doOnDestroy(citiesStore::dispose)
    of cause, it doesn’t work after configuration was changed. when should I dispose my store, if I reuse instance via instanceKeeper?
    a
    • 2
    • 20
  • a

    AG

    09/06/2020, 2:56 PM
    Hello, I’m trying to create multiplatform project using new kmm plugin, but I have a problem with ios when defining store
    Use of unresolved identifier 'DefaultStoreFactory'
    let store = NotesStoreFactory(DefaultStoreFactory())
    here is my build.gradle.kts file from shared module
    val commonMain by getting {
        dependencies {
            api("com.arkivanov.mvikotlin:mvikotlin:2.0.0-rc3")
            api("com.arkivanov.mvikotlin:mvikotlin-main:2.0.0-rc3")
            api("com.arkivanov.mvikotlin:rx:2.0.0-rc3")
           //other deps
        }
    }
    Can someone help me to figure out what was the problem ?
    a
    l
    • 3
    • 55
  • l

    lehakorshun

    09/20/2020, 2:39 AM
    Hi everyone. Is it normal to use labels to do something in the view (like navigation for example) ? from the scheme it is not right. but sometimes we can’t use the state for it.
    a
    j
    • 3
    • 25
  • j

    JimK

    09/29/2020, 3:55 PM
    For one-shot events in Jetpack Compose (with MVIKotlin + Decompose) is the best way to fire two Intents/Labels? The first setting a flag in the Model, second undoing it? I can't figure out how to get Compose to recognize the same event twice otherwise but I see issues down the line with this workaround.
    a
    • 2
    • 14
  • n

    Nikita Klimenko [JB]

    10/02/2020, 12:06 AM
    Hi. Sqldelight allows you to keep track of database changes via flow. But how should i integrate this flow with store? And most importantly, should i? For small feature - list of something that user can add/delete it seems like a good idea. Best i can think of is subscribing to flow in bootstrapper and spamming actions to update stores inner list. Feels like I'm missing some point. Thanks
    a
    • 2
    • 6
  • j

    JimK

    10/02/2020, 8:06 PM
    FYI if upgrading to newest Canary 13 while using Decompose the mpp/compose workaround needs to be updated to reflect the new compose compiler location refactor:
    project.dependencies {
            composeCompiler "androidx.compose.compiler:compiler:$compose_version"
        }
    a
    • 2
    • 22
  • s

    steelahhh

    10/04/2020, 3:49 PM
    Hey, I’ve recently started using mvikotlin with decompose in a project, and run into an issue when using any
    Bootstrapper
    , but
    SimpleBootstrapper
    After configuration change this exception occurs on application launch:
    java.lang.IllegalStateException: Value is already initialized: Function1<Action, kotlin.Unit>
            at com.arkivanov.mvikotlin.utils.internal.AtomicExtKt.initialize(AtomicExt.kt:7)
            at com.arkivanov.mvikotlin.extensions.coroutines.SuspendBootstrapper.init(SuspendBootstrapper.kt:26)
            at com.arkivanov.mvikotlin.main.store.DefaultStore.<init>(DefaultStore.kt:58)
            at com.arkivanov.mvikotlin.main.store.DefaultStoreFactory.create(DefaultStoreFactory.kt:21)
    Although this is easily avoided by using
    SimpleBootstrapper
    , I’m wondering is this behaviour intended or is there something that we have to do to prevent the exception from happening? The issue can be reproduced in decompose or mvikotlin sample app by replacing the
    SimpleBootstrapper
    by
    Suspend/ReaktiveBootstrapper
    a
    • 2
    • 8
  • j

    JimK

    10/11/2020, 2:19 PM
    @Arkadii Ivanov how do you feel about a similar plugin functionality in Decompose as badoo/Ribs? I'm looking to extend the component context functionality to include an authorization component and I'm waffling between tweaking decompose internals or investigating the plugin route
    a
    r
    • 3
    • 14
  • m

    miqbaldc

    10/21/2020, 4:07 PM
    Does MVIKotlin have a file template as well? similar like badoo here
    a
    • 2
    • 2
  • j

    Jon Miller

    11/01/2020, 4:05 PM
    I'm looking into applying MVI pattern and this project looks great. Do you see any issue with utilizing libraries like FlowBinding with it? https://github.com/ReactiveCircus/FlowBinding
    ➕ 1
    a
    • 2
    • 1
  • e

    Ermolenko Alexandr

    11/09/2020, 8:13 AM
    Hi there. Does MVIKotlin have something like a MVICore's post processor. Or do we need to send a Label which will send Intent to the same Store?
    a
    • 2
    • 3
  • e

    Egor K.

    11/29/2020, 10:28 AM
    Hi! Can I ask a quastion?  How I can correctly display a dialog using Label without using a State? For instance. I check some condition in Executor in SimpleBootstrapper and according to result of the condition I decide to show user some dialog.
    a
    • 2
    • 8
  • t

    tieskedh

    12/05/2020, 2:42 PM
    I have set up my app using clean architecture. Thereby, I have UseCase-classes which have an Input and transform it in an Output-flow or a single value. I want to hook this up with this framework. MVIKotlin should only know about the state of the application. I think the executor should therefor make decisions to start/stop a Use-case? I think using a sealed class
    Task
    which the binder then connects to the real use-cases is the best way? The output of the use-cases should then be dispatched to the reducer. Probably using the binder too? Intents that only need simple updates (which don't need suspending) can be dispatched by the Executor itself. The other alternative would be to give the Use-case classes all to the executor (which is a SuspendingExecutor after all), but I think this approach is way cleaner. The Task-class could be implemented using Label with a lambda to dispatch. Is this the way to go, or is there a better one?
    a
    • 2
    • 8
  • s

    Stanislav

    01/16/2021, 2:23 PM
    Hi! I have someStore (MVI store) that save in instanceKeeper, I call someStore.dispose(), and store go to state isDisposed = true, how I think I can't work with this store anymore, but why instance of store saved in instanceKeeper? Can I do something with disposable store? @Arkadii Ivanov
    a
    • 2
    • 2
  • e

    Egor K.

    02/02/2021, 5:21 PM
    @Arkadii Ivanov Hi. Can I ask about transfer some events from one feature to another? For example: by clicking on the back button on screen A, I gonna go to the previous screen B, and the item list should be updated on screen B. Something like eventbus comes to mind. Create some SharedFlow, emit event from Store A and collect it in Store B. But where I should collect it? In custom Bootstrapper in Store B? How do you recommend implementing such logic?
    a
    • 2
    • 6
  • s

    Shabinder Singh

    02/17/2021, 10:02 PM
    MVI approach is all solid and gr8 and leaves no place for unintended behaviour/things to happen or atleast we can say it minimises it to gr8 extent! However i have been developing most of my projects in MVVM and as now i am trying out to port the same projects to MVI , i feel like MVI requires more effort or you can say its more time-consuming . I also feel MVI is more clean and descriptive ! Anybody else feels same? If yes is that extra effort worth it ? , and is MVI your goto choice for large scale apps?
    a
    o
    • 3
    • 2
  • a

    Archie

    03/02/2021, 2:53 AM
    Hi, I was wondering how to cancel a request in MVI? Lets say an intent starts a network request but another intent must cancel it?
    a
    • 2
    • 1
  • n

    Nikiizvorski

    03/17/2021, 4:36 PM
    Hi i was wondering which project would you recommend at this stage if we want the most clean way of MVI. Would you recommend MVIKotlin or MVICore both to me looks great and the implementation feels good. I still want to do my own implementation over it. But a little confused which one is looking better at this stage to me. In a way i prefer the MVIKotlin more. To me both look very very good. I am asking from the point that soon i will be starting a new project that might turn out to be a multi platform one and there will be new people that i might need to introduce the MVI implementation. I would like them to be able to grasp it quicker and was curious for your input. Thank you
    a
    • 2
    • 2
  • d

    Davide C

    03/29/2021, 2:16 PM
    Hi @Arkadii Ivanov, in a multiplatform project (mobile) with MVIKotlin, is it feasible to adopt JetpackCompose on Android side, forgetting about fragments and lifecycle? Any hint on how to trigger recomposition on state updates?
    a
    • 2
    • 3
  • m

    marzelwidmer

    03/31/2021, 8:55 AM
    hello is there also a beginner tutorial. for MVI I am a new. something like MVI pattern with just Input field and output text. witch jetpack compose.
    a
    • 2
    • 2
  • s

    Shawn Tucker

    04/01/2021, 6:32 PM
    Hello, what should I do when my
    store
    is too big to be persisted? Until today, I reflected in my
    state
    object, which
    data
    I should query. This is important because my
    data
    can be too big for my
    savedStateHandle[android]
    to restore. The problem I am facing with this approach is that sometime my
    state
    depends on the
    data
    and sometime the
    data
    depends on my
    state
    . Any suggestions/articles that address that
    state != data
    and can help me find a better approach that solves the issues I am facing?
    a
    • 2
    • 2
  • i

    iamsteveholmes

    04/07/2021, 5:52 PM
    I've been working through the samples for my own project. At the moment my view doesn't appear to access the data from the model on Ios/SwiftUI at least from the preview screen. I'm a little confused where the ViewModel and ViewEvents come from on IOS. Are they generated? For instance, from the example:
    import Foundation
    import TodoLib
    
    class TodoListViewProxy: BaseMviView<TodoListViewModel, TodoListViewEvent>, TodoListView, ObservableObject {
        
        @Published var model: TodoListViewModel?
        
        override func render(model: TodoListViewModel) {
            self.model = model
        }
    }
    Where is the TodoListViewModel generated? If I set up a preview here and there was data being accessed from the model (using sqldelight in this case), would we expect the preview to show the data?
    a
    • 2
    • 8
  • m

    Mike

    04/08/2021, 10:18 AM
    Is there a recommended way to fire off a one-time event from the Store to the View? Currently I’m setting a bool and then clearing it (or using the diff tool), though I don’t need to store these one-time events in the state or model. For example, a one-time event could be: Scroll to the top of the current view
    s
    a
    • 3
    • 3
Powered by Linen
Title
m

Mike

04/08/2021, 10:18 AM
Is there a recommended way to fire off a one-time event from the Store to the View? Currently I’m setting a bool and then clearing it (or using the diff tool), though I don’t need to store these one-time events in the state or model. For example, a one-time event could be: Scroll to the top of the current view
s

steelahhh

04/08/2021, 10:54 AM
Probably
Label
– check out the todo sample, specifically
TodoAddStore
or
TodoDetailsStore
a

Arkadii Ivanov

04/08/2021, 10:54 AM
As Aleks mentioned, take a looks at Labels. https://arkivanov.github.io/MVIKotlin/store.html I should describe this in more detail probably.
m

Mike

04/08/2021, 11:00 PM
Thanks
View count: 4