I went through this tutorial tonight on using a MV...
# compose
r
I went through this tutorial tonight on using a MVVM (model, view, viewmodel) architecture with SwiftUI and Combine tonight https://www.raywenderlich.com/4161005-mvvm-with-combine-tutorial-for-ios. Very compelling way to build apps. Decouples the UI from the state nicely in a redux/vuex kind of way while being 100% reactive and declarative with minimal boilerplate. I’d love to see something similar with Compose/Coroutines once it’s released 🙂
v
I was under the impression that all those patterns like MVP or MVVM became obsolete with Compose and its "events up actions down" paradigm
👍 2
r
The lessons from the web communities that adopted these patterns (React/Vue/Angular) is that you still need state management. Managing all state locally in components becomes a mess very quickly.
a
I'm pretty excited about where effects let us go with compose for these things. You can call a function that looks like, "get me the current value of this stream" and that call subscribes to that stream under the lifecycle of the composable, causing it to recompose whenever a new value is emitted. A few of our devrel samples did it with LiveData similar to:
Copy code
@Composable
fun Foo(data: LiveData<Thing>) {
  val current = +observe(data)
3
Just using public API, no magic, bring whatever your favorite stream library is
I can't wait to hook Flow up to it, but there is still some missing functionality in the IR compiler and coroutines at the moment
👍 5