https://kotlinlang.org logo
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
  • n

    Nikola Milovic

    12/30/2021, 12:57 PM
    Hey Arkadi, a couple of questions regarding Decompose project that I forked. ( trying to modernize React samples ) 1. How can I update dependencies? After updating the value in
    deps.versions.toml
    it doesn't seem to be reflected anywhere 2. How can I run specific projects eg,
    ./gradlew :sample:master-detail:browserRun
    task doesn't exist. 3. Have you had the chance to think about the Browser Routing issue? Any pointers on how to recreate configuration? As the part of getting the data and manipulating the URL is simple enough
    a
    • 2
    • 8
  • n

    Nacho Ruiz Martin

    12/31/2021, 7:12 PM
    Hey Arkadi, Have you ever had the use case in which you need some parameters in the creation Store that will be provided to the Bootstrapper? For example a creation/edition screen’s store in which you can provide with an id of an item or not. If you provide it, the Bootstrapper will dispatch the fetch action. How would you do this? Thanks 🙇
    a
    • 2
    • 4
  • a

    Arkadii Ivanov

    01/01/2022, 12:40 AM
    Happy New Year! 🎉🥳🥂
    🎉 9
    n
    • 2
    • 3
  • l

    Laurence Muller

    01/05/2022, 2:44 AM
    Q: https://arkivanov.github.io/Decompose/extensions/compose/#custom-animations is it possible turn off animations completely when routing between components? Or should I create a fake animation (one that goes from A->B directly)
    a
    • 2
    • 2
  • l

    Laurence Muller

    01/07/2022, 5:26 PM
    Hello, I am trying to implement a UX where something in the
    store
    is triggering an alert (once) that the UI is suppose to react up on. Similar to maybe a classic android toast/snackbar message or maybe a 'no internet' message that shows up for a few seconds before fading away. Currently I have something that looks like: Shared module
    // Store Interface
    internal interface ScreenAStore : Store<Intent, State, Label> {
        sealed class Intent {
            data class xxx(val xxx: String) : Intent()
        }
    
        data class State(
            val xxx: String = ""
        )
    
        sealed class Label {
            object ShowAlert : Label()
        }
    }
    // Store Factory
    internal class ScreenAStoreFactory(
        private val storeFactory: StoreFactory,
        private val appRepository: AppRepository
    ) {
        fun provide(): ScreenAStore =
            object : ScreenAStore, Store<Intent, State, Label> by storeFactory.create(
                name = "ScreenAStore",
                initialState = State(),
                bootstrapper = SimpleBootstrapper(Unit),
                executorFactory = ::ExecutorImpl,
                reducer = ReducerImpl
            ) {}
    
        private inner class ExecutorImpl : CoroutineExecutor<Intent, Unit, State, Msg, Label>() {
            ...
            // In the executor 
            private fun setAlert() {
                publish(Label.ShowAlert)
            }
            ...
        }
    // Component
    class ScreenAComponent(
        ...
    ) : ScreenA, ComponentContext by componentContext {
        private val scope: CoroutineScope = CoroutineScope(Dispatchers.Main)
    
        override fun onBackPressed(): Boolean {
            scope.cancel()
            return true
        }
    
        private val store =
            instanceKeeper.getStore {
                ScreenAStoreFactory(
                    storeFactory = storeFactory,
                    appRepository = appRepository
                ).provide()
            }
    
    
        init {
            backPressedHandler.register(::onBackPressed)
            scope.launch {
                store.labels.collect { label ->
                    when (label) {
                        is Label.ShowAlert -> {
                            Napier.d("Show message similar to a Toast in Compose UI")
                        }
                    }
                }
            }
        }
    
        override val model: Value<Model> = store.asValue().map(stateToModel)
    }
    Android app
    @Composable
    fun ScreenAUi(component: ScreenAComponent) {
        Scaffold(
            modifier = Modifier
                .fillMaxSize(),
            topBar = {
                ScreenAHeader(component)
            }
        ) {
            ScreenABody(component, it)
        }
    }
    
    @Composable
    private fun ScreenABody(component: ScreenAComponent, innerPadding: PaddingValues) {
        val model by component.model.subscribeAsState()
    
        Box(
            modifier = Modifier
                .fillMaxSize()
                .padding(innerPadding)
        ) {
            // Display some stuff
        }
    }
    What's the recommended way to consume this one time
    label
    event?
    a
    n
    • 3
    • 15
  • n

    Nikola Milovic

    01/08/2022, 10:16 AM
    Hey @Arkadii Ivanov, I tried altering the React samples prior to NY but got stuck on an issue that I still haven't been able to resolve. Here's my take on it https://github.com/Nikola-Milovic/Decompose/tree/react-samples, this is the approach I use in my production app currently, it has been working really well for me, but for some reason Counter sample just won't work properly. The Master-Detail works as intended. The state inner component for example is getting rerendered when pressing OnNextChild in the root as it should, but the counter and components aren't getting propagated properly and stay on the
    counter0
    forever I'll continue tinkering with it but might as well ask you if you notice anything out of the ordinary.
    a
    • 2
    • 3
  • r

    rsktash

    01/20/2022, 11:36 AM
    Hi when device orientation changes connection between UI and Model being closed. Did I miss something I’ve not tested orientation changes before
    a
    • 2
    • 11
  • i

    iamsteveholmes

    01/25/2022, 5:54 PM
    Hi All! Are there any samples of using MVIKotlin3.0Ax/Decompose and Coroutines? I’ve been working on updating my MVIKotlin app to 3.0A3 and Decompose and loving the compose-jb sample but it uses reaktive.
    a
    • 2
    • 4
  • r

    rsktash

    01/27/2022, 9:29 PM
    [Solved] Hi I’ve encountered an issue with nested root components. Seems to be
    unregister
    is not being called when navigated back from inner router The error occurs when 1. I navigate to inner router component A. 2. Navigate back 3. and again navigate to router component A Root Router -> Inner Router -> Child -> NavBack -> Navigate forward
    a
    t
    • 3
    • 8
  • y

    ynsok

    01/28/2022, 12:30 PM
    Hi 😄 Are there any samples of how to create nested navigation with Decompose ? 😄
    a
    • 2
    • 1
  • r

    rsktash

    02/09/2022, 2:09 AM
    Hello I’m having error after AS update to Dolphin canary 1 As a workaround I added dependency for all modules of my KMP project supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath com.arkivanov.essenty:parcelable
    a
    • 2
    • 4
  • v

    vngantk

    03/04/2022, 12:40 AM
    Can anyone answer this question about the MVI design pattern? Why don’t we model the data flow from the View to the ViewModel simply using methods exposed by the ViewModel? Instead many MVI implementations use a kind of event/messaging mechanism and model the intents as message objects. This doesn’t seam to me very necessary, and it makes the whole architecture needlessly complicated.
    a
    • 2
    • 1
  • a

    Artyom Bambalov

    03/16/2022, 11:00 AM
    Hi, can you provide an example of post processing? Do you have any plans to add PostProcessor like in MVICore? Thanks
    a
    • 2
    • 8
  • a

    Akram Bensalem

    03/31/2022, 10:19 AM
    Hello, I'm trying to export Decompose for iOS part but I always get this error !!
    The following build commands failed:	PhaseScriptExecution [CP-User]\ Build\ shared /Users/akrambensalem/AndroidStudioProjects/EzLive/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script-4552119A071AC6BAB7327E6434237EC3.sh (in target 'shared' from project 'Pods')
    (1 failure)
    a
    • 2
    • 6
  • i

    iamsteveholmes

    03/31/2022, 4:36 PM
    Any examples of using a swiftui tabview with the decompose router?
    a
    • 2
    • 5
  • a

    Akram Bensalem

    03/31/2022, 9:20 PM
    Is there any example of how to use Decompose with "Compose web" without integrating React ?! ... I couldn't find equivalent to " .subscribeAsState() "
    a
    • 2
    • 3
  • a

    Akram Bensalem

    04/03/2022, 4:40 PM
    Hi! I wonder if anyone here tried before to manage the url with Decompose for the web using Compose for web ?
    a
    • 2
    • 14
  • a

    Arkadii Ivanov

    04/06/2022, 5:40 PM
    Also I think imports should be resolved regardless of the HMPP enabled or not in the library.
    i
    • 2
    • 9
  • y

    ynsok

    04/12/2022, 1:00 PM
    Hi, I’m testing StateKeeper and for some reason my state is not surviving process death, any clue ?
    class MainActivity : AppCompatActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContent {
                val store = Store(stateKeeper())
                Text(text = store.state.number.toString())
            }
        }
    }
    
    
    @Parcelize
    data class State(val number: Int) : Parcelable
    
    class Store(stateKeeper: StateKeeper) {
        val state: State = stateKeeper.consume("Register") ?: State(Random.nextInt())
    
        init {
            stateKeeper.register("Register") { state }
        }
    }
    a
    a
    • 3
    • 10
  • t

    Travis Reitter

    04/19/2022, 4:22 PM
    Hi, I'm looking at the
    todoapp
    example as a model for rebasing my app on MVIKotlin. I'd like to make my migration a little more gradual and just rewrite the root view at first (which is already a list view in my app) and have item taps launch the existing detail view `Activity`s directly like it currently does. In the
    todoapp
    , tapping on an item ends up in
    TodoRootUi
    with
    TodoRootContent()
    returning the Edit composable and this is all within the
    compose-ui
    module instead of the Android module. What's the best way to instead launch an
    Activity
    on Android and display a specific
    ViewController
    on iOS? I definitely want to migrate the rest of the UI to match the
    todoapp
    model but want to avoid rewriting all of the UI in one step 🙂
    a
    • 2
    • 6
  • a

    Arkadii Ivanov

    04/30/2022, 10:28 PM
    MVIKotlin 3.0.0-beta02 is released! • Added experimental
    Store
    DSL (#30) • Removed
    ExperimentalCoroutinesApi
    annotations, because the used coroutines API is no longer experimental (#28) • Refactored all samples (#29) • Updated docs (#31, #32)
    👀 1
    🎉 5
    :cool-doge: 1
    :kotlin-intensifies-purple: 2
    a
    • 2
    • 5
  • d

    doubov

    05/05/2022, 6:57 PM
    Curious if the following workflow is supported: 1. Setup a Flow<Model> (not a one-time action, but a stream that's dependent on some input) 2. Upon receiving new input, cancel the old Flow<Model> stream and restart it with the new input If
    intents
    were a Flow<Intent>:
    intents.filterIsInstance<Intent.A>.flatMapLatest { intent -> repo.fetchModels(intent.input).map { data -> Msg.SetData(data) } }
    Upon receiving
    Intent.A
    we cancel the previously setup
    repo.fetchModels(...)
    stream and restart it with the new input. As far as I can see, this isn't really doable with the current implementation, unless I've missed something. Thanks in advance! 🙏
    a
    • 2
    • 2
  • d

    doubov

    05/09/2022, 4:22 PM
    What are the benefits of the Bootstrapper component? Mostly curious about the rationale behind having a dedicated component instead of having a set of initial `Intent`s that get passed to the Store?
    a
    • 2
    • 6
  • l

    Lawrence

    05/14/2022, 2:24 AM
    Hi, I wanted to know what's the point of mapping from State to Model? Both seem to be pretty much the same? Couldn't we just do
    Value<State>
    ? https://github.com/JetBrains/compose-jb/blob/master/examples/todoapp/common/main/s[…]mmonMain/kotlin/example/todo/common/main/integration/Mappers.kt
    ✅ 1
    a
    a
    • 3
    • 8
  • l

    Lawrence

    05/26/2022, 4:37 PM
    are there any examples that make use of Labels?
    ✅ 1
    a
    • 2
    • 5
  • a

    Andrew Steinmetz

    06/04/2022, 2:32 AM
    Has anybody ever implemented paging with MVIKotlin or know of a sample?
    a
    • 2
    • 1
  • t

    Travis Reitter

    06/12/2022, 3:07 PM
    hi, can anyone recommend code samples for MVIKotlin on iOS with traditional
    UIView
    -based `ViewController`s? I'd like to migrate to MVIKotlin before migrating to SwiftUI
    a
    • 2
    • 9
  • z

    Zsolt.bertalan

    07/13/2022, 4:36 PM
    Is there a way to make sure all Intents are executed when the Fragment is being destroyed? I have to do some analytics tracking when the Fragment is paused. My Fragment is in a ViewPager, and on some devices there are no more than 2 milliseconds to send the intent before everything is destroyed, but I have to do a little calculation as well, which is enough to miss it sometimes. What I did for now is that I copied the code from com.arkivanov.mvikotlin.extensions.coroutines.Binder.kt, and added a delay to the BuilderBinder.stop function like this:
    override fun stop() {
            GlobalScope.launch(mainContext) {
                delay(DELAY_STOP)
                job?.cancel()
                job = null
            }
        }
    First of all, is this correct? Is this the best I can do? Maybe, does it make sense to add this to the library?
    a
    • 2
    • 21
  • a

    Arkadii Ivanov

    07/13/2022, 10:07 PM
    MVIKotlin v3.0.0 is released! Full release notes: https://github.com/arkivanov/MVIKotlin/releases/tag/3.0.0 What's new since v3.0.0-beta02 - Reordered DSL generics (#36) - Replaced getMainThreadId stack trace with error message (#37) - Updated Kotlin to 1.7.1, Gradle to 7.4.2, AGP to 7.2.0, Essenty to 0.4.2, coroutines to 1.6.3 (#44, #46) - Added settings dialog to IDEA Time Travel Plugin (#41) - The Time Travel desktop client app is now built on CI, artifacts are attached to releases (for Windows and Linux only, please build from sources for macOS)
    🎉 7
    :kotlin-intensifies-purple: 2
    a
    • 2
    • 4
  • f

    Francis Mariano

    07/22/2022, 11:05 AM
    hello folks. Is it mandatory use compose with mvikotlin and decompose???
    a
    • 2
    • 12
Powered by Linen
Title
f

Francis Mariano

07/22/2022, 11:05 AM
hello folks. Is it mandatory use compose with mvikotlin and decompose???
a

Arkadii Ivanov

07/22/2022, 11:11 AM
Hey! Not at all, you can use any combination of the mentioned libraries. However, Decompose is primarily designed for declarative UI frameworks. Even though there are extensions for classic Android views, the experience would be much smoother with Compose.
f

Francis Mariano

07/22/2022, 11:23 AM
ok, thank you. My last project I used classic views + MVP with KMM. now I am going start a new project and I am looking for better approach. Maybe I will use classic views again but with no MVP pattern. Do you think classic views + mvikotlin (without decompose) works fine?
a

Arkadii Ivanov

07/22/2022, 11:35 AM
Sure, MVIKotlin works just fine with any UI framework!
The MVIKotlin sample uses classic Android views https://github.com/arkivanov/MVIKotlin/tree/master/sample
f

Francis Mariano

07/22/2022, 11:38 AM
Nice. I will give a chance for decompose too. The shared router is really good.
Arkadii, my last question 🙂 . Decompose works fine with classic iOS views too???
a

Arkadii Ivanov

07/22/2022, 11:43 AM
For Decompose, you can check its sample as well. For Android, it features both Compose and Views UIs. https://github.com/arkivanov/Decompose/tree/master/sample For iOS, both MVIKotlin and Decompose samples use SwiftUI.
f

Francis Mariano

07/22/2022, 11:44 AM
ok thank very much for your support.
a

Arkadii Ivanov

07/22/2022, 11:45 AM
Decompose can work with any UI framework, including UIKit (classic iOS views). But there is no additional support (extensions) from the library, so you will have to come up with your own.
The most tricky part would be navigation - switching views following the Decompose router state.
f

Francis Mariano

07/22/2022, 11:52 AM
OK. I am doing a brainstorm myself. Android - classis view + decompose + mvikotlin iOS - SwiftUI + decompose + mvikotlin But the correct is use compose in android and swiftUI in iOS. And using compose everywhere in a near future.
a

Arkadii Ivanov

07/22/2022, 11:58 AM
Compose may be more convenient to use over Android views, but may be less stable or performant (e.g. list scroll may still lag, there are known memory leaks, etc.). On iOS the situation with SwiftUI is kinda the same - more convenient but not as stable as UIKit. But definitely - the future is with Compose and SwiftUI.
🙌 1
View count: 8