Hi I am new to TCA, enjoying a lot already.
I have a button running an action which is async. Once the operation is done, I want to pop to previous screen. In my State class I have a property called isOrderCompleted. In my reducer operation finishes then state gets update -isOrderCompleted- but don't know how to trigger pop in my SwiftUI view.
where / how is the best approach for this scenario?
I have used Notification post on Receive atm to do this.
Interesting, that seems like a pretty good solution!
There's one other possibility, but it uses iOS 14 so won't be viable for awhile. But, just for posterity, you could store a value in your state that determines when you want to dismiss (such as
isPresented), and then use the new
onChange(of:perform:) API to listen for when it flips to
false, and when it does call
Neither or ideal, but they'll work. I think I like your notification method best tbh
Thanks a lot.
After some trying, thought easy way to keep going coding :D
Was this mentioned anywhere during the WWDC sessions?
Edit: Damn, this is brilliant! Totally slipped past my radar, but it’s so helpful.