nobre84/RNConcurrentBlockOperation — pull request #1 by jflinter (2014-03-30 08:08:27+00:00)
Title: Add userInfo property to RNConcurrentBlockOperation

Hey there, I've been using your excellent microlibrary to cut down on tricky NSOperation boilerplate. I do have one issue with it, which is that it's effectively impossible in its current form to return anything from an RNConcurrentBlockOperation. Obviously you can't "return" anything in the classical sense from performing an NSBlockOperation, but typically when I want to get something out of an NSOperation I'll subclass and expose a method on it that I can then call to ask for the results of the operation.

I've implemented this in a generic way for RNConcurrentBlockOperations by exposing a userInfo dictionary on it and adding a parameter to RNCompletionBlock. This way, instead of calling completion() with no arguments as part of your block, you call it with an optional NSDictionary that the operation can hang onto. Then whatever enqueued the operation can ask for that userInfo and effectively retrieve its results. I've been finding it pretty useful on my end. Do note, however, that this PR is a breaking change, as you now have to pass an argument (even if it's just nil) to an RNCompletionBlock.

Thanks! Hope you like this.