Make it easier to subscribe to state changes from the native code
Opened this issue · 0 comments
Tiagoperes commented
Today, to observe a state from the native code, it's necessary to implement the interface Dependent
. To interact the nimbus state with the Compose or SwiftUi state we also need to use MutableStateFlow
on Compose and ObservableObject
on SwiftUI.
This process is more complicated than it should be. Instead, we should provide an easier way to subscribe to a state. An idea is to implement an extension that automatically provides the MutableStateFlow
or ObservableObject
.
An example where this is necessary is in our sample app "Store". We need to observe the global state that stores the shopping cart: