I'm trying to make my code more functional and more reactive. I create a request like this:
[RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
PHContentEditingInputRequestOptions *options = [PHContentEditingInputRequestOptions new];
options.networkAccessAllowed = YES;
options.progressHandler = ^(double progress, BOOL *stop) {
// update UI
};
[asset requestContentEditingInputWithOptions:options completionHandler:^(PHContentEditingInput *contentEditingInput, NSDictionary *info) {
// subscriber send next/completed/error
}];
return [RACDisposable disposableWithBlock:^{
// here I should kill request if still active
}];
}];
To cancel an iCloud request I have to set *stop = YES;
in the progressHandler
. How to do this in the reactive way?
I have managed to solve this with
NSMutableArray
captured in the block.