I have a series of UIViewControllers (popups) in my app that I use to gather information from the end user. I managed to chain them with promises like this:
firstly {
return showFirstPopup()
}
.then { info1 -> Promise<Info2> in
dismissFirstPopup()
//Do sth with info1...
return showSecondPopup()
}
.then { info2 -> Promise<Info3> in
dismissSecondPopup()
//Do sth with info2...
return showThirdPopup()
}
.then { info3 -> Promise<Info4> in
dismissThirdPopup()
//Do sth with info3...
return showForthPopup()
}
...
.catch { error in
//Handle any error or cancellation...
}
If, for example, the user presses back in the third popup I need to go back to the previous "then" and not cancel the whole flow.
Basically I need to be able to go back one step, let the user edit the data, then continue the flow.
Is there a way to do this with PromiseKit?