【发布时间】:2018-06-13 18:03:16
【问题描述】:
我是 RxSwift 的新手,遇到以下问题。
给定两个函数:
struct Checkout { ... }
func getSessionIdOperation() -> Single<UUID>
func getCheckoutForSession(_ sessionId: UUID, asGuestUser: Bool) -> Single<Checkout>
我有第三个函数,它结合了两者的结果:
func getCheckout(asGuestUser: Bool) -> Single<Checkout> {
return getSessionIdOperation()
.map { ($0, asGuestUser) }
.flatMap(getCheckoutForSession)
}
getSessionIdOperation和getCheckoutForSession都可能失败,如果失败,我只想重新启动整个链一次。我尝试了retry(2),但只是重复了getCheckoutForSession。 :(
【问题讨论】: