Is there any way we can have a method that returns a Block? I have two activity objects to whom I have to send the same completion block. In the completion block I am using the reference to the MyTester object also. I wanted to have the block code at a single place only so that if there is any change in it, it could be changed at one place itself.
__block MyTester *aBlockSelf = self;
self.myActivity1.completionBlock = ^(NSDictionary *iData) {
if (([[iData valueForKey:@"value"] length] > 0)) {
[aBlockSelf handleThis:iData];
} else {
// Some Logic
}
// Some Logic
};
self.myActivity2.completionBlock = ^(NSDictionary *iData) {
if (([[iData valueForKey:@"value"] length] > 0)) {
[aBlockSelf handleThis:iData];
} else {
// Some Logic
}
// Some Logic
};