You can see that the store is scoping onto some optional state and passing it to the IfLetStore view. Then the 2 callback closures are invoked depending on that optional state: then is either invoked with a store of non-optional state, or else is invoked with nothing.
There's another example in the Voice Memos demo, which is used for a "current recording" in state depending on if it's nil or not:
Sorry bumping the old posts.
TCA is a great, but I cannot find how to listen to state changes and give an action, IfLetStore is awesome and it works really well, but it requires View as return value.
Is there a void version command of IfLetStore ?
Hi @hebbian, it's not clear what you are trying to accomplish and why IfLetStore would be used to solve it. Can you start a new forum post that describes in detail the problem you are having with as much code as possible?
It isn't appropriate to execute functions inside the the body of a view. This goes for vanilla SwiftUI too.
The onAppear hack is better, but also leaves you with an empty Text view lying around. You should move this logic to the reducer when the observedState is populated with data.