I would like to do something like
Completable.empty()
.andThen { // this does not work
// run some code
NSLog("Now pushing objects")
return Completable.empty // e.g. return api.pushObjects() -> Completable
}
.andThen(Completable.empty()) // this is working
.andThen { // this does not work
// do something else
NSLog("Now pulling objects")
return Completable.empty // e.g. return api.pullObjects() -> Completable
}
andThen (or concat) does not allow closures as argument. The compiler complains:
Trailing closure passed to parameter of type 'Completable' (aka 'PrimitiveSequence<CompletableTrait, Never>') that does not accept a closure
My question is: How to chain completables with closures?