I’m trying to define a block that takes a block as an argument.
What’s wrong with the following line of code?
id (^cacheResult)(NSString *, id(^)(void)) = ^(NSString *name, id(^)(void)block) {
NSObject *item = nil;
block();
return item;
};
Why does the compiler keep giving errors like Parameter name omitted and Expected ")"?
Blocks have similar syntax to function pointers. You have to declare block name after the ^