I have a little trouble understanding how this works. I am currently working with a sync table which uses calls like the following:
-(void)addItem:(NSDictionary *)item completion:(CompletionBlock)completion{
[self.syncTable insert:item completion:^(NSDictionary *result, NSError *error) {
[self LogErrorIfNotNil:error];
}];
I understand how you can use a block as a parameter to execute some extra code within your function, for example with dispatch_async. but when it comes to this line
[self.syncTable insert:item completion:^(NSDictionary *result, NSError *error) {
result is here a dictionary including all extra columns that follows after "item" has been added to the table. Thinking about it,it seems that "result" is more like the resulting type of addItem: instead of being a parameter of the method (due to being the result of the executed method)
EDIT: Basically, I don't understand where the NSDictionary *result variable comes from. To me it seems it should be return type of addItem:item