【发布时间】:2017-11-13 16:42:59
【问题描述】:
我的应用中有一系列 UIViewController(弹出窗口),用于从最终用户那里收集信息。我设法用这样的承诺将它们链接起来:
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...
}
例如,如果用户在第三个弹出窗口中按回,我需要返回到上一个“then”而不是取消整个流程。
基本上我需要能够后退一步,让用户编辑数据,然后继续流程。
有没有办法用 PromiseKit 做到这一点?
【问题讨论】:
标签: ios swift promisekit