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.
Button(action: {
viewStore.send(.pay)
}){
Text("Pay")
}
where / how is the best approach for this scenario?
Thanks
Selcuk
I have used Notification post on Receive atm to do this.
mbrandonw
(Brandon Williams)
3
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 presentation.dismiss().
Neither or ideal, but they'll work. I think I like your notification method best tbh 
1 Like
Thanks a lot.
After some trying, thought easy way to keep going coding :D
Doug
5
Was this mentioned anywhere during the WWDC sessions?
Edit: Damn, this is brilliant! Totally slipped past my radar, but it’s so helpful.