icerockdev / moko-mvvm

Model-View-ViewModel architecture components for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
1k stars 95 forks source link

Add commands queue to iOS EventsDispatcher #12

Closed Alex009 closed 4 years ago

Alex009 commented 4 years ago

To support case of immediate dispatches after EventsDispatcher pass to ViewModel:

class EnterPhoneScreen(
) : WidgetScreen<Args.Empty>() {
    override fun createContentWidget(): Widget<WidgetSize.Const<SizeSpec.AsParent, SizeSpec.AsParent>> {
        val viewModel = getViewModel {
            createViewModel(createEventsDispatcher()).apply { start() } // HERE RUN START, where event call immediate
        }
        viewModel.eventsDispatcher.listen(this, this) // HERE SUBSCRIPTION

        // ...
    }
}
Alex009 commented 4 years ago

merged